Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.
Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???
thanx,
marcus
<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell. com";
$text = urlencode("This is an example message");
$to = "0123456789 ";
// auth call
$url = "$baseurl/http/auth?user=$user &password=$pass word&api_id=$ap i_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
$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>mes sage ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentica tion failure: ". $ret[0];
exit();
}
?>
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.
Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???
thanx,
marcus
<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell. com";
$text = urlencode("This is an example message");
$to = "0123456789 ";
// auth call
$url = "$baseurl/http/auth?user=$user &password=$pass word&api_id=$ap i_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
$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>mes sage ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentica tion failure: ". $ret[0];
exit();
}
?>
Comment