curl - PHP fsockopen help required -


i trying work on cloudflare api , have found in documentation. unfortunately have no idea how can use in fsockopen or through curl. here example of post request. need know how can make request below data post using curl or fsockopen

curl https://www.cloudflare.com/api_json.html  -d 'a=cache_lvl' \ -d 'tkn=8afbe6dea02407989af4dd4c97bb6e25' \ -d 'email=sample@example.com' \ -d 'z=example.com' \ -d 'v=agg' 

here link cloudflare https://www.cloudflare.com/docs/client-api.html#s4.2

try one:

$ch = curl_init("https://www.cloudflare.com/api_json.html"); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_ssl_verifypeer,false);  // handling of -d curl parameter here. $param = array(     'a' => 'cache_lvl',     'tkn' => '8afbe6dea02407989af4dd4c97bb6e25',     'email' => 'sample@example.com',     'z' => 'ex' ); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, http_build_query($param));  $result = curl_exec($ch); curl_close($ch);  print $result; 

Comments

Popular posts from this blog

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -