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

Hello Everyone !


First of all I want to congratulate FLSM developer team for this great application.

 At this time I'm trying to use the http trigger option to sent personalize message to each member of my team. The variable fields and core message are stored on a local Mysql DB. The idea is to create a small PHP snipe that bring the variables from the DB and encapsulated them into the message. I had succeed to pull information from the DB but I'm still having trouble to create the function to sent the SMS.  Now my question is: what it would be the easiest way to do this using PHP ?  I've tried   php Headers () it works when I sent One by One message -  but when I put them on a loop it gives me error ( I seems that it should be a Unique Header on each function). Also I tried Curl () but  still not sure if I need to use such powerful tool for something "simple" like this....   Any little clue it would be really Appreciated ( I'm sorry but, a lot things had change since my days with  Cobol & Fortran  LoL)


Best Regards !!





Views: 499

Reply to This

Replies to This Discussion

Hi Peter,


I think you're on the right path!

I guess you should try to reach the web resource through a socket or open/read functions (see


This should work as expected!




Hi Morgan,


Thanks for your kindly reply...

Good starting point, I'm going to try sockets first as I've had done some work with C++ in the past...  Thanks again for your hint.

I will post the results later on.



Hi Peter,


Maybe this will help


Looks like you can use fopen() or file_get_contents() - should be as simple as that!


Best of luck - and let us know how you get one,



Hi Alex & Morgan,


We were working on the function with a friend in India.. we made it work last night. What we did was to create a Mysql DB with the info, including different variables fields. We use cURL function and put it on a loop.  I'll post the function later on this afternoon. I guess it would be very useful for most people using FLSM.


Thanks again for your help and continue development of this great application!


Best Regards,



Hi Peter,


Glad it's working!  And thanks for offering to share your script - look forward to it.



Here is the copy of the PHP script  - Hope it helps !!



include_once("config.php"); // database definition
include_once("dbclass.php"); // sql Where Conditios

$objDB = new DB();

// Query messages by campaign ID //
if(isset($_POST['campaignid']) && $_POST['campaignid'] != "")
$Query = "select * from custom_fields where campaign = '".$_POST['campaignid']."' ";
$rs = $objDB->select();


$counter = 0;

foreach($rs as $data)
// You can change the format or the message here
//------- Message Format ----------
$message =rawurlencode($data['var1']." ".$data['var2']." ".$data['var3']." ".$data['var4']);
//------- Message Format ----------
$url = "http://localhost:8000/send/sms/".$data['phone']."/".$message."/";

// Using Curl

$output = curl_exec($curl_handle);
$content.= $url." - ".$output; // used for debug
$content.="- ".$data['phone']."<br/>"; // used for debug




Can the same thing be done using jsp..

If yes, can you guide me with that



Rahul Matkar.

Hi Rahul,


I'm sure it can.  I'm unable to provide a tutorial on JSP, but perhaps you could outline specific parts of the process you would like help with.



I'm Sorry Rahul, But I don't have the knowledge but I'm sure that it can be done.




can u also provide the config and the dbclass php files?

Reply to Discussion


© 2017   Created by FrontlineSMS Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service