I am presently developing an SMS application entitled " SMS Virtual Clinic, which aims to help patient to know the possible cause or diagnose their illness as they send SMS keyword like “medication” and send to my short code number. Here’s what i did:
<?php
$globe = new GlobeApi('v1');
$sms = $globe->sms([87258]);
$response = $sms->sendMessage([access_token], [number], [message]);
Array (
"outboundSMSMessageRequest" => Array (
"address" => "0915xxxxxxx",
"deliveryInfoList" => Array (
"deliveryInfo" => [],
"resourceURL" => null
),
"senderAddress" => "21587",
"outboundSMSTextMessage" => Array (
"message": " Diagnose with "
),
"receiptRequest" => Array (
"notifyURL" => null,
"callbackData" => null,
"senderName" => null,
"resourceURL" => null
)
)
)
?>
This code will send message from 21587
And here’s my receive SMS php code:
<?php
$json = file_get_contents('php://input');
$json = stripslashes($json);
$values = json_decode($json, true);
Array {
"inboundSMSMessageList" => Array {
"inboundSMSMessage" => Array {
[0] => Array {
"dateTime" => "Tue March 11 2014 12:12:13 GMT
+0000 (UTC)",
"destinationAddress" => "2xxxxxx",
"messageId" => null,
"message" => "Hello",
"resourceURL" => null,
"senderAddress" => "915xxxxxxx"
}
},
"numberOfMessagesInThisBatch" => 1,
"resourceURL" => null,
"totalNumberOfPendingMessages" => null
}
}
$list[$name] = mysql_escape_string($value);
list($action, $name, $address, $course, $yearlevel)=explode
('/',$list);
if($action == 'reg')
{
$db=mysql_connect("localhost", "root", "******") or die
("Cannot connect to DB!");
mysql_select_db("cyfdb") or die("Cannot select DB!");
$sql="INSERT INTO mydb (name,address,course,yearlevel)
VALUES ('$name','$address','$course','$yearlevel')";
$r = mysql_query($sql);
if(!$r) {
$err=mysql_error();
print $err;
exit();}
$mysql_close($db);
}
else if($action=='inq')
{
$link=mysql_connect("localhost", "root", "******") or die
("Cannot connect to DB!");
mysql_select_db("mydb") or die("Cannot select DB!");
$sql = "SELECT event,location,time from activity";
while($r = mysql_fetch_array($sql)){
$items[] = array('event'=>$r['event'],
'location'=>$r['location'],
'date'=>$r['date']);
}
return $items;
$mysql_close($link);
}
else if($action== 'SMS-NOTIFICATION')
{
list($action, $messagetype, $source, $type) =explode ("
",$list);
}
return $list;
}
}
?>
This will save all the messages into a database repository
My problem is it did not work for me.
Please help me fix this problem?