how to ping a server using different ip addresses in php
<p>I want to ping a server using different ip addresses.</p>

<p>below is the sample code:</p>

<pre><code>&lt;?php

$ip = '76.76.21.246';
$port = '9000';

$server = 'blogsearch.google.com';


$fp = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)&lt;br /&gt;\n";
} else {
    $out = "POST /ping/RPC2/ HTTP/1.1\r\n";
    $out .= "Host: {$server}\r\n";
    $out .= "Connection: Close\r\n\r\n";
    fwrite($fp, $out);
    while (!feof($fp)) {
    echo fgets($fp, 128);
}
fclose($fp);
}
?&gt;
</code></pre>

<p>I am getting "requested url could not be retrieved" error</p>

<p>Can anyone let me know what is wrong in my code?
Thanks in advance</p>
