basic cURL question

Here is my code:

$curl_handle = curl_init($url) or die('You need cURL installed to use this tool.');
curl_setopt($curl_handle, CURLOPT_HEADER, 0);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);

How do I get the response comming from that url? (And I don't want to set returntransfer to 0.)
Huji
LVL 14
hujiAsked:
Who is Participating?
 
star_trekCommented:
<?php  
   $curl_handle = curl_init($url);
   curl_exec($curl_handle);
   $info = curl_getinfo($curl_handle);
   print_r ($info);
?>
0
 
hujiAuthor Commented:
It is returning something like this:

Array ( [url] => http://www.google.com/ [content_type] => text/html [http_code] => 200 [header_size] => 302 [request_size] => 101 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 1.125 [namelookup_time] => 0.016 [connect_time] => 0.438 [pretransfer_time] => 0.438 [size_upload] => 0 [size_download] => 3042 [speed_download] => 2704 [speed_upload] => 0 [download_content_length] => 0 [upload_content_length] => 0 [starttransfer_time] => 0.906 [redirect_time] => 0 )

The page content (the HTML in this case) is not there.
0
 
hujiAuthor Commented:
I've found my mistake. Everything except the content is there. I get the header the way I usually do:
print curl_exec($curl_handle);
Thanks for your help.
Huji
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.