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

curl-and-php

Empty response from script with HTTP/0.9 200 OK

From: <sales_at_glype.com>
Date: Sun, 9 Dec 2007 09:30:14 -0500 (EST)

Hello.

If I try to run the following code:
<?php
$toSet[CURLOPT_CONNECTTIMEOUT] = 20; // Time to wait for connection
$toSet[CURLOPT_TIMEOUT] = 45; // Time to wait for whole operation
$toSet[CURLOPT_RETURNTRANSFER] = true; // Return transfer instead of
printing
$toSet[CURLOPT_FAILONERROR] = true;

if (
isset($_SERVER['HTTP_USER_AGENT']) ) $toSet[CURLOPT_USERAGENT] =
$_SERVER['HTTP_USER_AGENT'];

$toSet[CURLOPT_SSL_VERIFYPEER] =
false;
$toSet[CURLOPT_SSL_VERIFYHOST] = false;

$curl =
curl_init('http://www.facebook.com/');
curl_setopt_array($curl,
$toSet);

$return = curl_exec($curl);

if ( $error =
curl_error($curl) )
   echo 'ERROR: ',$error;

curl_close($curl);
echo $return;
?>

I get a
blank page from the server with a strange HTTP/0.9 200 OK response header.
This happens about 12 seconds after requesting it. It happens somewhere in
the curl_exec() call before any headers are received (tested using the
CURLOPT_HEADERFUNCTION). If I echo out debug info, it gets to the
curl_exec() but no further. If I write debug info to a text file, it works
fine - although I think the log file is not written to until about 10
seconds after I get the empty response.

This happens only to
www.facebook.com and no other sites. Below are a few mentions of DNS
problems that I guess could be the cause?
http://groups.google.com/group/comp.protocols.dns.bind/browse_thread/thread/d92ade2d7fc36ed9
http://member.dnsstuff.com/forums/showthread.php?p=14732738

I
really don't know enough about this area to have any idea where to start
with this. Any help is much appreciated.

Regards,
Nick
Collins

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-12-09