PHP - cURL Get response body -


how can print response content url because preview empty

    $ch = curl_init();     curl_setopt($ch, curlopt_url, $url);     curl_setopt($ch, curlopt_followlocation, 1);      curl_setopt($ch, curlopt_header, 0);     curl_setopt($ch, curlopt_returntransfer, 1);     curl_setopt($ch, curlopt_referer, $ref);     curl_setopt($ch, curlopt_cookiejar, cookie.txt');     curl_setopt($ch, curlopt_cookiefile, cookie.txt');     curl_setopt($ch, curlopt_ssl_verifypeer, false);      curl_setopt($ch, curlopt_useragent, "mozilla/5.0 (windows; u; windows nt 5.1; rv:1.7.3) gecko/20041001 firefox/0.10.1");     curl_setopt($ch, curlopt_post, 1);     curl_setopt($ch, curlopt_postfields, $post_fields);     $output = curl_exec($ch);     curl_close($ch); 

picture:

  1. you need echo out response

    echo $output;  
  2. i noticed missing single quotes around name of cookie file , cookie jar.. should become

    curl_setopt($ch, curlopt_cookiejar, 'cookie.txt'); curl_setopt($ch, curlopt_cookiefile, 'cookie.txt'); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -