fsockopen without result or error




I've come accross a problem. For a customer, we implemented a Google search. They have a deal with Google and thus are allowed to offer that.

To get the searchresults from Google, we use fsockopen like this:

$socketHandle = fsockopen($googleHost, $googlePort, &$errorNumber, &$errorMessage, 10);
if (! $socketHandle) {
   echo "\n";

Sometimes $socketHandle is null or false, but still $errorNumber is 0 and so is $errorMessage...

How can I track the reason for failing to open the socket?

Sorry for nagging... I really hope someone can help me with this problem. It's getting really urgent.. :(

All I can get from the PHP manual is:
If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket.
Unfortunately it doesn't tell me where I can find the cause or why it doesn't happen all the time...
:oops: never mind

The customer has recently added 2 servers to the existing 6, all behind a load balancer.

However, they forgot to setup DNS on the new servers which meant that PHP couldn't resolve the hostname and thus couldn't connect... It's fixed now...

Still weird that I didn't get an error for not being able to resolve the hostname...