Jump to content

problems with loading a url to send a txt msg


p_tru

Recommended Posts

i'm trying to send a text message using a url but it doesn't seem to be working and i can't see errors in my coding, can someone help me i would be very grateful.


[code]
<?php
//connect to database
include 'db.private';
        
       $connection = mysql_connect($hostname,$username,$pwd)or die(mysql_error());
       mysql_select_db($databaseName, $connection)or die(mysql_error());

SESSION_START();
if ($_SESSION[validated] == "yes") {//a
    

if (isset($_POST['Submit'])) {//b


$user = "john";
$password = "boy";
$api_id = "198";
$baseurl ="http://api.clickatell.com";
$text = urlencode("You have successfully booked your seat");
$to = "44784552";
// auth call
$url = "$baseurl/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") {//c
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
    echo "success<br>message ID: ". $send[1];
    else
    echo "send message failed";
    } //c
    else {
    echo "Authentication failure: ". $ret[0];
    exit();
      }
}//b
//a
}else {
    echo "you have not logged in";
}
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.