Re: sending SMS messages to mobile phones from PHP
| From: | Andrew Cowles | Date: | Tue, 12 Oct 2004 12:06:30 +0000 |
| Subject: | Re: sending SMS messages to mobile phones from PHP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199252@lists.php.net to get a copy of this message | ||
You can send an SMS via kapow easily using PHP.
Here are a few examples of how you can send (via HTTP Get/Post & email).
assuming you have defined a couple of variables;
$user = "youruser";
$pass = "yourpass";
$mob = "447971325173";
$message = urlencode("This is just a test SMS message from kapow.co.uk");
You can send the message via HTTP Get using the fopen() function, like this;
fopen("http://www.kapow.co.uk/scripts/sendsms.php?username=$user&password=$pass&mobile=$mob&sms=$message","r")
That's it... your message will be on it's way (and should arrive within about 10 seconds).
Alternatively you could send via email by using the mail() function;
mail("$mob@kapow.co.uk","$message","$user\n$pass");
If you have set-up your account to automatically trust your sending address then you don't need to include the user/pass details in the email, so it'd work with just;
mail("$mob@kapow.co.uk","$message","");
You can also make an HTTP Post. The best way to do this is by writing a quick HTTP Post function using sockets... you should be able to find an example on this mailing list. If not then I'll happily send you one.
Best regards,
Andy
Andrew Cowles
====================================
KAPOW! SMS Communication Solutions
WEB: http://www.kapow.co.uk/
EMAIL: andrew.cowles@kapow.co.uk
TEL: 0870 757 1610 or FAX: 0870 757 1615
====================================
Cygnet Internet Services Ltd ( http://www.cygnet.co.uk/ )
====================================
Thanks. Your SMS service looks ideal for what I need but how do I make an HTTP request from PHP to kapow? Can I just use fopen()? Please can you give a PHP example.We operate an SMS Gateway service (http://www.kapow.co.uk/) which would do exactly what you need. It's been reliably sending SMS since 1995 - and MANY of our clients usePHP.What you'd probably want to do is make an HTTP Get / Post request directly from your script to our servers, alternatively you can use ourEmail-to-SMSinterface and then just generate an email. Using either method with PHP should get you up and running in a fewminutes.