curl-and-php
Re: error when using curl
Date: Fri, 6 Jun 2008 22:41:51 -0500
On Fri, Jun 6, 2008 at 10:37 PM, Brock Noland <brockn_at_gmail.com> wrote:
> In regards to:
>
> http://curl.haxx.se/mail/curlphp-2008-03/0037.html
> http://curl.haxx.se/mail/curlphp-2008-03/0036.html
> http://curl.haxx.se/mail/curlphp-2008-03/0044.html
>
> That is, getting "Curl error: Failed to open/read local data from
> file/application" when using curl via php. Was there a resolution to
> this? I can verify this same problem with the following code.
>
> <?php
> $host= 'http://bashcurescancer.com/dump-request-variable.php';
> $CR = curl_init();
> curl_setopt($CR, CURLOPT_TIMEOUT, 60);
> curl_setopt($CR, CURLOPT_URL, $host);
> curl_setopt($CR, CURLOPT_POST, 1);
> curl_setopt($CR, CURLOPT_FAILONERROR, true);
> curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0);
> $body = curl_exec( $CR );
> print $body . "\n";
> $error = curl_error( $CR );
> if( !empty( $error ))
> print("Curl error: ".$error);
> curl_close($CR);
> ?>
>
> However, if you add
>
> curl_setopt($CR, CURLOPT_POSTFIELDS, "name=daniel");
>
> it works. I get this error php with:
>
> libcurl/7.11.0 via PHP 4.4.7 (cli) (built: Aug 3 2007 23:29:24)
> curl-7.12.1-11.el4 via PHP 5.2.4 (cgi) (built: Oct 22 2007 13:37:40)
>
> I do not get the curl with:
>
> libcurl/7.11.0 via PHP 4.4.7 (cli) (built: Aug 3 2007 23:29:24)
> curl-7.12.1-11.el4 via PHP 5.2.4 (cgi) (built: Oct 22 2007 13:37:40)
Scratch that...I do not get the error with:
libcurl/7.11.0 via PHP 4.4.7 (cli) (built: Aug 3 2007 23:29:24)
curl-7.12.1-11.el4 via PHP 5.2.4 (cgi) (built: Oct 22 2007 13:37:40)
However, I do get the error with libcurl/7.18.1 via the following:
PHP 5.2.6 (cgi) (built: May 24 2008 22:17:29)
PHP 4.4.8 (cgi) (built: May 24 2008 21:59:05)
>
> As such...I am not sure if this the php binding or libcurl.
>
> Respectfully,
> Brock
>
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-06-07