FrontlineSMS

FrontlineSMS let users send, receive and manage SMS over a mobile network.

hi alex,

             we can retrieve message easily from mysql database,and sent t0o flsms and finally to the mobile user..but the now problem is how can we update the database by a messge,like if the user send say   rice 25 .then it has to update the database table row ion that rice to 25.

my focus here is .hw can i save the keyword name in this case,say for ex,if i saved keyword as rice .then how can i retrieve 25 in the message content..n give that value to the php script.....will you please help me out in this regard...

 

regards,

ramakrishna.p

Views: 86

Reply to This

Replies to This Discussion

Hello Ramakrishna,

this can be easily done with HTTP requests, available in the External commands.
You should be able to do this easily with the help files.

What I'd suggest though is to set up an unique keyword for this purpose (i.e. "PRICE") and then let your web script (PHP or whatever) recognize the product you are giving a new price for. People would then send :
PRICE rice 25
or
PRICE pepper 30

Please let us know if you don't understand how this works.

Best,
Morgan

morgan,i got you what you said ,if you put PRICE as a keyword ,then my question is what i need to include in the url,anyhow i have to get the variable "rice " in my php script to set the value "25" .i have to get the whole message content like for example say :price rice 25 is the message content,now php script hav to get the input saparately as price in one variable,rice to another variable,and 25 to another variable.how can i fed this from flsms to php..and even if i write saparately keyword for every item,its nt a efficient one,its as like filling all keywords in the software....

 

i hope you got me ,what i said to you...

thanks in advance,

regards,

ramakrishna.p

 

Hi,



let's try to keep this simple:

Just create a single keyword, like PRICE, and set an external command action for it.

This action would be an HTTP Request, reaching a web script you wrote, and where the whole SMS content is passed.

It should look like : http://yourdomain/yourscript.php?content=${message_content}

 

That way, your script will receive everything the user wrote after "price".

Then, just split the request (see http://fr.php.net/manual/en/function.explode.php), and you'll have your different arguments.

 

Hope that helps.

 

Morgan

 

hi kmorgan,

                       thank you very much,actually now i got to kno,why we are using $messge content, thanks a lot morgan,i ll back to you if i got any doubt ok,keep in touch..

 

regards,

ramakrishna.p..

Hi Ramakrishna,

 

${message_content} is one of the subtitution variables recognised by FrontlineSMS. This token will be replaced by its actual value at sendtime.

 

Let's take an example:

 

- You have a "SAY" keyword, which forwards messages to your mobile

- The contact "FLSMS Fan" (number +123456) writes: "SAY FrontlineSMS is awesome"

 

Then the substitutions variable will look something like:

${sender_name} -> FLSMS Fan

${sender_number} -> +123456

${keyword} -> SAY

${message_content} -> FrontlineSMS is awesome

 

Then, in your Autoforward action, you could write this as the text message:

Hi, ${sender_name} (${sender_number}) just used the keyword "${keyword}" and is saying: ${message_content}

 

This will send you something like:

Hi, FLSMS Fan (+123456) just used the keyword "SAY" and is saying: FrontlineSMS is awesome

 

---------

 

Now you can maybe understand better why we are using the ${message_content} substitution variable in our PRICE example:

http://yourdomain/yourscript.php?content=${message_content}

 

This way, your PHP script will have in its "content" variable, the value of everything following the keyword "PRICE".

Examples:

PRICE rice 25 ----> The PHP "content" variable will be : "rice 25"

PRICE pepper 30 ----> The PHP "content" variable will be : "pepper 30"

 

In both cases, splitting the "content" variable into words (with the "space" character) will result in having the product (first word) and the actual price (second word).

 

Hope you understand it better now :-)

 

Best of luck,

Morgan

hi morgan,

                  till now i was doing my website,that too both in english and also in our regional language kannada.it s very nice,and even we got many prize for that.and in that we are providing almost all information regarding farmers needs.

         now with regarding to the FLSMS  i ve one doubt regarding my code that i written...

 i ll paste here..

<?php
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
}

$produit=$_GET['produit'];

$produit = explode(" ", $produit);

$second=$produit[1];


mysql_select_db("frontlinesms", $con);

mysql_query("UPDATE prduct SET price=$second
WHERE pname = 'mango'");

mysql_close($con);
?>

 

i ll send the message as mango 25...now my intension here is to update the table by name prduct with mango price as 25.

but now am getting error like <br><fontsize>.....that is page source is commming as reply messge to me.and mango price automettically set to zero..

hiope you reply for this...

and if i simply run the php script by giving manually input like..... mango 25..........then it ll reflect in database,but if it send through mobile.then it ll show error in line number 12.

RSS

© 2014   Created by FrontlineSMS Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service