Link to home
Start Free TrialLog in
Avatar of huji
hujiFlag for United States of America

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of star_trek
star_trek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of huji

ASKER

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.
Avatar of huji

ASKER

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