Hi,
Im using a script that is to send a users reset password upon request via sms but im getting the following error when i execute the script.
Warning: file(http://api.clickatell.com/http/sendmsg?session_id=39abc1e8a9706e8064d9f02f9f32da55&to=353879108720&text=Your new password is XXXXXXX&from=templateit.net&deliv_ack=0): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in /home/substan/public_html/interface/files/smsFunctions.php on line 39
smsFunctions.php looks like this:
<?php
/* smsFunctions.php - holds sms functions. To be included in sms_sending.php */
/**
* Open a session with clickatell so we can send the sms's
* Session remains open until 15mins of inactivity
* Returns session id
*/
function authenticateSMS() {
$user = "clonmelog";
$password = "password";
$api_id = "637109";
// auth call
$url = "http://api.clickatell.com/http/auth?user=$user&password=$password&api_id=$api_id";
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
return $sess_id;
}
// Authentication failed
else {
return FALSE;
}
}
/**
* Send the sms through the clickatell gateway
* Uses a pre-established session
*/
function sendSMS($session,$mobileNo,$message) {
$to = $mobileNo;
$from = urlencode("templateit.net");
$url = "http://api.clickatell.com/http/sendmsg?session_id=$session&to=$to&text=$message&from=$from&deliv_ack=0";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
// Message sending successful
if ($send[0] == "ID") {
return TRUE;
}
// Message sending failed
else {
return FALSE;
}
}
?>
I have no idea whats going on.
any help please?