0

I want to send SMS using way2sms api from localhost. How can I send SMS from localhost using way2sms api?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rohan Hapani
  • 139
  • 1
  • 3
  • 16
  • In which programming language you want to send sms.Way to sms php api are available on internet .you can use them to integrate with your site – CyberAbhay May 09 '17 at 05:22
  • download Way2SMS-API-master from github and use like this include('Way2SMS-API-master/way2sms-api.php'); if(sendWay2SMS ( 'registered_number' , 'password' , 'sms_receiver_number' , 'Hello World')) { echo "hi msg sent "; } else { echo "msg sending failed "; } – JYoThI May 09 '17 at 05:25

1 Answers1

0

Basically 2 steps:

  1. First log in
  2. Send the message

To do this, you have to use Curl, or you can just keep it simple and not doing it over again and use this api: https://github.com/kingster/Way2SMS-API

<?php
    include('way2sms-api.php');
    sendWay2SMS ( '9000012345' , 'password' , '987654321' , 'Hello World');   
    sendWay2SMS ( '9000012345' , 'password' , '987654321,9876501234' , 'Hello World');   
?>
Richard87
  • 1,592
  • 3
  • 16
  • 29
  • Did you add the `way2sms-api.php` in your project folder? – Richard87 May 09 '17 at 05:41
  • @Richard87..yes – Rohan Hapani May 09 '17 at 05:46
  • There are no any error message receive.. but message wasn't send – Rohan Hapani May 09 '17 at 05:53
  • Then you have some work ahead of you... Either try a different API (do they have an official api?), or try to fix the one you are using... Start verifying that you can logg inn by debugging the application and se what the return values from curl_exec is in the login function... – Richard87 May 09 '17 at 05:57
  • It is return this => SSSHTTP/1.1 302 Found Cache-Control: no-cache Content-length: 0 Location: http://site23.way2sms.com/ Connection: close – Rohan Hapani May 09 '17 at 06:06
  • strange, that makes no sense :P CURL should follow the redirect to `site23.way2sms.com` !!! Scratch that, change this line in the API to true: `curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, false);` – Richard87 May 09 '17 at 06:08
  • No, unless they have a public api it will always be a hack... So you will always have to test and maintain the code... But what was the response from `curl_exec in login()` this time? – Richard87 May 09 '17 at 06:30