I saw a post at http://www.php.net/manual/en/ref.curl.php where it says:

"Using the customrequest for a complete post is wrong. Libcurl will add
a partial url, the http version and the standard headers after the post
data - while this works with a non-persistent connection and an apache
web server, it may fail under different conditions"

Does anybody know a bit more on this?? (I sent an e-mail to the one
who posted it, but the address does not longer exist)

I tested the following code and didn't experience any problem:

<?

$url =  "http://www.mydomain.com";;

$request = "GET / HTTP/1.1\r\n".
       "Host: www.mydomain.com\r\n\r\n";
       
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
curl_setopt ($ch,CURLOPT_CUSTOMREQUEST , $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$reply = curl_exec($ch);
curl_close ($ch);

echo '<pre>';
echo $reply;

?>

but using ngrep on a server of mine I can see this as the request:

GET / HTTP/1.1.
Host: www.mydomain.com.
.
 / HTTP/1.1.
Host: www.mydomain.com.
Pragma: no-cache.
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*.


may be this is what he's talking about when he says about the data
libcurl will add?

does anybody know under which circumstances may this fail??

thanks in advance,

Juan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to