0

I am new to sockets and fsockopen(). I am trying to send SMS using a gateway. But the fsockopen always shows the following error.


Warning: fsockopen() [function.fsockopen]: unable to connect to alertbox.in:80
(A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in C:\wamp\www\pro\SendSMS.php on line 45

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\pro\SendSMS.php on line 45

The code Used is:

$fp = fsockopen("alertbox.in", 80);
if (!$fp) 
{
echo "$errstr ($errno)<br />\n";
} 
else 
{
// $out = "GET / HTTP/1.1\r\n";
// $out .= "Host: $host\r\n";
// $out .= "Connection: Close\r\n\r\n";
$out .=$host."?".$request."\r\n";
echo $out;

fwrite($fp, $out);
while (!feof($fp)) 
{
echo fgets($fp, 128);
}
fclose($fp);
}

can anybody please help me out for this problem? Thanks in advance.

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by kokoro90
0

When I tried it on my server, it worked. Are you sure that the machine you are doing this on is able to access alertbox.in ? The error seems to point to the computer not being able to reach that address.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.