Convert cURL command to cURL PHP Convert cURL command to cURL PHP curl curl

Convert cURL command to cURL PHP


In get request you just have to pass the params with the URL itself, following code should work:

$ch = curl_init();$url = "https://api.clashofclans.com";$clansId= "2399VY9JR8";$headers= array("authorization: myToken");curl_setopt($ch, CURLOPT_URL, $url.'clans/'.$clansId);curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);$result = curl_exec($ch);print_r($result);curl_close($ch);