0

i am trying to send SMS to multiple users.
SMS string is being generated in a loop and is sent with that loop.
The code which does the actual sending is below

$host = "http://alertbox.in/pushsms.php";
		
		$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);
		}

But this generates an 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

Can please anybody help me out.I am new to both these SMS and Sockets

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

I believe you'll need to use the complete host information:

$fp = fsockopen("alertbox.in", 80);

should be

$fp = fsockopen($host, 80);
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.