Plz help

Plz help SearchSearch
Author Message
mona
New member
Username: Mona

Post Number: 1
Registered: 01-2009
Posted on Friday, January 09, 2009 - 03:24 pm:   

Hi
How can I do this process using nowsms and php

I have local server url return account balances and I need to send an sms to nowsms to retarn the plan text to me cell phone
The url is http://localhost/balance/balance.php?user=xxxxx&password=xxxxxxx
The prefix well be (balance) the test msg from my phone to nowsms well be

Balance u xxxx p xxxx

Thanks
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 362
Registered: 08-2008
Posted on Friday, January 09, 2009 - 09:54 pm:   

Hi Mona,

You would need to write an additional PHP script (or modify your current script) to perform further parsing of the message.

You could define the following as your 2-way command:

http://localhost/balance/balancesms.php?request=@@SMS@@

If you sent in a text as follows:

Balance u xxxx p xxxx

Then the resulting command to be executed would be:

http://localhost/balance/balancesms.php?request=u%20xxxx%20p%20xxxx

The "%20" looks a little funny in the URL ... but that's just URL escaping. When you access it from your script, your scripting language should convert it back into a space. (The space character needs to be escaped to be included in a URL.)

So the end result is that your script would need to parse the string "u xxxx p xxxx".

You could have a simple PHP script that did this parsing, then redirected to the existing PHP script with the parameters set as needed.

--
Des
NowSMS Support
mona
New member
Username: Mona

Post Number: 2
Registered: 01-2009
Posted on Sunday, January 11, 2009 - 10:07 am:   

final now woooooooooooooow its working thanks
===============================
<?php
header ("Content-Type: text/plain");
$request=$_GET['request'];
//str_replace("%20"," ",$request)
//print ("$request");
$v = explode(' ', $request);
//echo "$v[0]<br>"; // the u character
//echo "$v[1]<br>"; // the username
//echo "$v[2]<br>"; // the p character
//echo "$v[3]<br>"; // the password
//$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
//echo $url
if ($source =
file_get_contents("http://127.0.0.1/balance/balance.php?user=$v[1]&password=$v[3]")) {
print $source;
} else {
echo "Could not retrive You Account Or User Name And password Error, please
contact administrator email@hotmail.com";
}
?>