curl-and-php
Re: debugging curl
Date: Fri, 28 Mar 2008 23:38:54 +0400
Hello Michael,
> I've been trying to use the code here to get debugging information
>
> <?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?title=Debugging_Curl_scripts
>
> Yet it is providing a response as a blank screen.
If you will enable only CURLOPT_VERBOSE all data will be sent to STDERR
as it is written in docs. and not to the browser (except the case when
you are executing script from SSH command line, in that case you
will see all debug data in your SSH window). To log debug information
you have to first: enable CURLOPT_VERBOSE and second: specify
CURLOPT_STDERR file:
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_STDERR, $fp);
where $fp is file handle to output errors (in out case debug information)
to. e.g.
$fp = fopen(dirname(__FILE__).'/errorlog.txt', 'w');
That code works fine for me ;) Hope my post helps
-- Best regards, Vitali mailto:v.simsive_at_gmail.com p.s. I hope this message will be added as replay and not as a new port :) _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2008-03-28