PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
michaelh613
Forum Commoner
Posts: 38 Joined: Sun Mar 16, 2008 1:35 pm
Post
by michaelh613 » Sun Mar 16, 2008 3:10 pm
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
www.WeAnswer.IT
Forum Newbie
Posts: 24 Joined: Wed Mar 19, 2008 6:33 pm
Post
by www.WeAnswer.IT » Wed Mar 19, 2008 7:51 pm
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;
michaelh613
Forum Commoner
Posts: 38 Joined: Sun Mar 16, 2008 1:35 pm
Post
by michaelh613 » Wed Mar 19, 2008 11:30 pm
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