experchange > php

Adnan Shiekh (02-21-15, 12:56 AM)
Hi everyone,

i want to receive a message using smsgateway.me api, i have successfully send sms, but i can't receive message.. help me in this situation.. thanks in advance
Jerry Stuckle (02-21-15, 02:25 AM)
On 2/20/2015 5:56 PM, Adnan Shiekh wrote:
> Hi everyone,
> i want to receive a message using smsgateway.me api, i have successfully send sms, but i can't receive message.. help me in this situation.. thanks in advance


Are you sure the sms message is properly addressed to your server?

Have you checked smsgateway.me support? When working with a package,
your first line of support is almost always the support section for that
package.
Denis McMahon (02-21-15, 05:42 AM)
On Fri, 20 Feb 2015 19:25:02 -0500, Jerry Stuckle wrote:

> On 2/20/2015 5:56 PM, Adnan Shiekh wrote:


>> i want to receive a message using smsgateway.me api, i have
>> successfully send sms, but i can't receive message.. help me in this
>> situation.. thanks in advance


> Are you sure the sms message is properly addressed to your server?


> Have you checked smsgateway.me support? When working with a package,
> your first line of support is almost always the support section for that
> package.


I just looked at their API Jerry. It's the sort of thing I wouldn't touch
with a barge pole.

Their API works like this. You install their app on your phone. Then to
send an sms from your app on your phone, you send the sms to their
server, their server pushes it back to the app on the phone, and the app
on the phone then sends the sms from the phone.

Given that there's an api in the phone already to send an sms (which
their app uses), if you wanted to send an sms from your app, wouldn't it
make more sense to call the phone's api directly, rather than sending the
message through a third party server off the phone which simply bounces
it back to an app on the phone which calls the phone api.

I can't see the benefit to the person developing apps on a phone of
sending sms in such a convoluted manner, although I guess the people
running smsgateway.me are happily harvesting any data they can from the
sms texts passing through their system.

Daft doesn't begin to describe it. And why would you be using php to code
on an android device? It would make a lot more sense to code in java and
use the native apis.
Jerry Stuckle (02-21-15, 05:52 AM)
On 2/20/2015 10:42 PM, Denis McMahon wrote:
[..]
> Daft doesn't begin to describe it. And why would you be using php to code
> on an android device? It would make a lot more sense to code in java and
> use the native apis.


Hi, Denis,

I looked at it briefly, but not nearly as deeply as you did. From what
you said, I agree it's pretty convoluted. However, I see they also have
a PHP driver; are there any phones out there which run PHP? Or is it
something you can put on a PC or server to send SMS messages from there
(I still don't know how you'd receive a message).
Denis McMahon (02-21-15, 08:36 AM)
On Fri, 20 Feb 2015 22:52:22 -0500, Jerry Stuckle wrote:

> I looked at it briefly, but not nearly as deeply as you did. From what
> you said, I agree it's pretty convoluted. However, I see they also have
> a PHP driver; are there any phones out there which run PHP? Or is it
> something you can put on a PC or server to send SMS messages from there
> (I still don't know how you'd receive a message).


Oh - yeah, maybe it's a case of using your PHP app to send and receive
messages via your phone ... that might be more useful (I did wonder about
writing apps in php on a phone).

The only way I can see to receive messages is to poll their server for
them from the php app, which would either mean running a cron job
(reliable) or relying on someone accessing the PHP code manually to
trigger a poll.

Assuming the idea is that the php would be sitting on your web server
(now makes more sense I guess) that really means a cron job to poll for
incoming messages.

But even so, assuming the phone has an ip address, it would make more
sense for a phone app and your web server to communicate directly, rather
than via a third party server.

Hang your phone off the wifi on your lan, get the phone's lan ip, tell
the api code on the webserver to make it's rpc calls to the phone ip on
whatever port the phone app listens to. Then a java app on the phone
handles the rpc calls from the webserver and interfaces with the phone's
sms api.

And a third party isn't harvesting data from your sms traffic (except for
NSA / GCHQ and the mobile network operator, but that's hard to prevent).

Writing a java app for android to listen on a nominated port, receive a
json string over tcp/ip, talk to the phone sms api and then respond with
a json string over the same tcp/ip connection wouldn't be difficult.
Adnan Shiekh (02-21-15, 08:44 AM)
Hello everyone,

Thanks to all for reply , i have decided to explain my problem in detail, basically i have write a web service to send and receive sms using my android phone and if anyone can reply then my application auto reply to user, i am firstly use Smssync for this purpose but through this i can't message send successfully then i am decided to use smsgateway.me but through this api i am successfully send sms but not receive messages ,api claims to support receive messages but i have not done, if anyone can help me in this case and know better tools for this purpose please told me.... i have used in initial days EnvayaSms but i have not successfull to send sms using Envaya... thanks in advance
J.O. Aho (02-21-15, 10:58 AM)
On 21/02/15 07:44, Adnan Shiekh wrote:
> Hello everyone,
> Thanks to all for reply , i have decided to explain my problem in detail, basically i have write a web service to send and receive sms using my android phone and if anyone can reply then my application auto reply to user, i am firstly use Smssync for this purpose but through this i can't message send successfully then i am decided to use smsgateway.me but through this api i am successfully send sms but not receive messages ,api claims to support receive messages but i have not done, if anyone can help me in this case and know better tools for this purpose please told me.... i have used in initial days EnvayaSms but i have not successfull to send sms using Envaya... thanks in advance


Your web service has to ask the API to see if there is new message, you
have an example at


If you don't do this every X minute, you will never know that you got a
message. I recommend you to use a cron job for that part, so you need to
write a cli script and run it.

The phone will not in a magical way send a message to your script.
Adnan Shiekh (02-21-15, 06:36 PM)
i have know about how to fetch single which one sent from my android phone but i have not any issue about sending message only problem in receiving sms. any one can tell me how to receive sms using this api.. i have try to add callbacks "Message is received" but not working.... if any body know about the better approach for this api or solution of receiving message please tell me.. thanks
Jerry Stuckle (02-21-15, 07:58 PM)
On 2/21/2015 11:36 AM, Adnan Shiekh wrote:
> i have know about how to fetch single which one sent from my android phone but i have not any issue about sending message only problem in receiving sms. any one can tell me how to receive sms using this api.. i have try to add callbacks "Message is received" but not working.... if any body know about the better approach for this api or solution of receiving message please tell me.. thanks


Try asking the people who wrote the API. They know their code better
than anyone else. I don't think anyone here is going to spend the hours
necessary to understand the API. After all, we're all volunteers.
Allodoxaphobia (02-21-15, 09:25 PM)
On Fri, 20 Feb 2015 22:52:22 -0500, Jerry Stuckle wrote:
> I looked at it briefly, but not nearly as deeply as you did. From what
> you said, I agree it's pretty convoluted. However, I see they also have
> a PHP driver; are there any phones out there which run PHP?


> is it(? Is here...)
> something you can put on a PC or server to send SMS messages from there




See also for comments/discussion/examples:;



> (I still don't know how you'd receive a message).


True.
However, some cell service prividers permit texting to email addys.

Jonesy
Denis McMahon (02-22-15, 04:06 AM)
On Sat, 21 Feb 2015 08:36:47 -0800, Adnan Shiekh wrote:

> i have know about how to fetch single which one sent from my android
> phone but i have not any issue about sending message only problem in
> receiving sms. any one can tell me how to receive sms using this api.. i
> have try to add callbacks "Message is received" but not working.... if
> any body know about the better approach for this api or solution of
> receiving message please tell me.. thanks


It looks like the callback is meant to be a page on your web server that
the smsgateway.me requests to inform you that there is a message.

You want a php script on your webserver that might contain something like
the following code:

<?php

$mysecret = '<your api callback secret>';

if ($_POST['secret'] == $mysecret) {

switch($_POST['event']) {

case 'Received':
// an sms was received
// process received message
break;

case 'Sent':
// an sms was sent
break;

case 'Update':
// there was an update
break;

default:
// this should never happen
error_log('bad api callback event received in smscallback.php', 0);
}

}
else {
// record in your log that the secret was wrong
error_log('bad api callback secret received in smscallback.php', 0);
}

Then you log in to your account at smsgateway.me, you go to the events
page, you set up a callback event for received messages, you use the http
method, you set the secret to <your api callback secret> and you set the
http url to

This will inly work if the smsgateway.me server can connect to



If you are working from home with dynamic ip on adsl you will have all
sorts of network configuration issues to resolve, none of which are
relevant to the php newsgroup.
Adnan Shiekh (02-22-15, 05:25 PM)
thanks Denis alot...nice to meet you..:)
khurram (07-01-17, 08:26 AM)
Hi i am new in programming
i want to send sms using smsgateway.me Api

Here is my code:
include "smsGateway.php";
$smsGateway = new SmsGateway('demo', 'admin');

$deviceID = xxxxx;
$number = '+xxxxxxxxxxxx';
$message = 'Hello World!';

$options = [
'send_at' => strtotime('+1 minutes'), // Send the message in 10 minutes
'expires_at' => strtotime('+1 hour') // Cancel the message in 1 hour if the message is not yet sent
];

//Please note options is no required and can be left out
//$result = $smsGateway->sendMessageToNumber($number, $message, $deviceID, $options);
$result = $smsGateway->sendMessageToNumber($number, $message, $deviceID);
echo json_encode($result);
----------------------------------------------

i think my code is ok but i am getting this response

{"response":false,"status":0}

please help me
J.O. Aho (07-01-17, 08:34 AM)
On 07/01/17 08:26, khurram wrote:
> Hi i am new in programming
> i want to send sms using smsgateway.me Api


I suggest you visit the following page:


and ask for help there, as I doubt there is anyone who has used the API
in question and can answer you questions.
denispeterson96 (05-19-18, 08:53 AM)
{"response":false,"status":0} means you are not connected to the internet ... connect and try again

Similar Threads