-1

I've purchased access to an API for a SMS gateway so that I can send messages to mobile phones. They gave me a URL, a username and a password. I want to use this in my PHP program.

My SMS gateway provider gave me the following details:

HTTP Api for single or multiple SMS

http://yourURL/api/smsapi.aspx?username=yourUsername&password=yourPassword&to=9xxxxxxxxx,8xxxxxxxxx,7xxxxxxxxx&from=yourSenderId&message=Your message content.
  • username: Your login username.
  • password: Your login password.
  • to: Single mobile number or multiple mobile numbers separated by comma (Only 10 digits).
  • from: Approved sender id (Only 6 characters).
  • message: Your message content (Maximum 459 characters/3 messages).
    • Note: Only 100 mobile numbers are allowed.

I tried many ways to use this, but I couldn't find a solution. How would I implement this in my PHP program?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
user3328808
  • 43
  • 1
  • 4
  • 10
  • 1
    If you purchased a gateway, you should contact the seller for support. If you want anyone at SO to even take a look, you need to provide your code that is causing you problems, what you want to do, and what you have tried so far. – WWW Apr 16 '14 at 15:05
  • 1
    This seems quite unproffessional because you send the data unencrypted. A serious gateway offers HTTPS support. – Daniel W. Apr 16 '14 at 15:06
  • no sir , i tried but they say , they provide only api not support programming?? – user3328808 Apr 16 '14 at 15:07

1 Answers1

1

use CURL to call api.CURL is better way to call api.

<?php
$url = 'http://yourURL/api/smsapi.aspx?username=yourUsername&password=yourPassword&to=9xxxxxxxxx,8xxxxxxxxx,7xxxxxxxxx&from=yourSenderId&message=Your message content.';

$ch = curl_init(); 
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
$output=curl_exec($ch);
if(curl_errno($ch))
{
    echo 'error:' . curl_error($c);
}
curl_close($ch);

?>
shivanshu patel
  • 782
  • 10
  • 19