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

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

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

should be

$fp = fsockopen($host, 80);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.