Page 1 of 1
PHP curl debugging question
Posted: Sun Mar 16, 2008 3:10 pm
by michaelh613
I've been trying to use the code here to get debugging information
Code: Select all
<?php $curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://www.php.net");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_exec ($curl);
curl_close ($curl); ?>
http://hudzilla.org/phpwiki/index.php?t ... rl_scripts
Yet it is providing a response as a blank screen
Re: PHP curl debugging question
Posted: Wed Mar 19, 2008 7:51 pm
by www.WeAnswer.IT
When you set CURLOPT_RETURNTRANSFER to 1, you are telling PHP to return the results instead of outputting it.
Replace this in your code:
With this:
You can also save it to a variable if you want:
Code: Select all
$contents = curl_exec($curl);
$contents = str_replace("PHP", "TEST", $contents);
echo $contents;
Re: PHP curl debugging question
Posted: Wed Mar 19, 2008 11:30 pm
by michaelh613
www.WeAnswer.IT wrote:When you set CURLOPT_RETURNTRANSFER to 1, you are telling PHP to return the results instead of outputting it.
Replace this in your code:
With this:
You can also save it to a variable if you want:
Code: Select all
$contents = curl_exec($curl);
$contents = str_replace("PHP", "TEST", $contents);
echo $contents;
Thanks that actually wasn't my issue. It wasn't that I wasn't seeing the response it was I wasn't getting one (you could see a response in the browser. Strange thing it is coming now and we haven't changed anything. Probably a server side issue