Forum Moderators: coopster
I have a simple script that uses cURL to grab data from a server and display that in the browser. I can get it to work fine on servers with php4, but it won't display in the browser on servers with php5. It works for both through the shell though. Here is the cURL code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
//curl_setopt($ch, CURLOPT_NOBODY, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, "x-www-form-urlencoded");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$res = curl_exec($ch);
curl_close($ch);
$resp = explode("\n\r\n", $res);
$header = explode("\n", $resp[0]);
$body = explode("&", $resp[1]);
echo "<pre>";
print_r($header);
print_r($body);
echo "</pre>";
Does anyone know why this would break in PHP 5?
Thanks.
were these tested with the exact same page?
was the test exactly the same with the only difference being the php version?
did you view source to see if anything was there?
was it possibly a time out of the site trying to be grabbed?
did it work aside from the display?