1

I have an sms server installed on my computer and a gsm modem attached to the usb port, so if I hit http://localhost:9333/ozeki? on the browser a login page appears and after I log in there is a form using which I can send sms to mobile phones. This works fine.

Now to send sms from my web application(which will be running on localhost)

I have created a form and it looks like following

<form name="form" action="send.php" method="post">

<table width="600" align="center" border="1">
<tr>
<td>Sender </td> <td> <input type="text" name="sender" /> </td>
</tr>
<tr>
<td>Recepient </td> <td> <input type="text" name="recepient" /> </td>
</tr>
 <tr>
<td>Message </td> <td> <input type="text" name="message" /> </td>
</tr>

<tr>
<td colspan="2"> <input type="submit" name="submit" value="Send" /> </td>
</tr>

</table>
</form>

My send.php

   $recepient=$_POST['recepient'];
   $message=$_POST['message'];
   $sender=$_POST['sender'];

   $url='http://localhost:9333/ozeki?';
  $url.="action=sendMessage";
  $url.="&login=admin";
  $url.="&password=abc123";
  $url.="&recepient=".urlencode($recepient);
  $url.="&messageData=".urlencode($message);
  $url.="&sender=".urlencode($sender);
  file($url);

Now the problem is when I click on the submit button the page goes to send.php and usually it takes a lot of time to respond and when it finally does this error message appear:

Warning: file(http://localhost:9333/ozeki?action=sendMessage&login=admin&password=abc123&recepient={my_number}&messageData=comp&sender={my_number}) [function.file]: failed to open stream: 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:\xampp\htdocs\sms\send.php on line 14

Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\sms\send.php on line 16

7
  • Possible duplicate: stackoverflow.com/questions/2948893/… Commented Jan 17, 2012 at 16:23
  • You said there is a log in page you have to log into first before you can send an SMS. Are you sure that appending the login and password is correct? Maybe there is a cookie that it expects you to be sending instead of the details in the request. What happens if you paste your $url into the browser (without logging in first). Commented Jan 17, 2012 at 16:23
  • @AndrewR thanks for your reply. If I paste the URL I mean this-> localhost:9333/ozeki? then the user login page appears. Thanks :) Commented Jan 17, 2012 at 16:53
  • And Yes I have checked the login and password.. they are both correct :) Commented Jan 17, 2012 at 16:54
  • What I meant was, what do you get when you paste the full URL http://localhost:9333/ozeki?action=sendMessage&login=admin&password=abc123&recepient=01672095631&messageData=comp&sender=01719349818 - Does it send your message? Commented Jan 17, 2012 at 16:54

1 Answer 1

0

Try file_get_contents() instead of file().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.