cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: error when using curl

From: Brock Noland <brockn_at_gmail.com>
Date: Fri, 6 Jun 2008 22:37:43 -0500

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)

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