通过SSL连接发送短信 [英] SMS Sending by SSL Connection

查看:85
本文介绍了通过SSL连接发送短信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过SSL Conection连接到服务器,

发送短信。

提供短信服务的公司提供了一些代码一个http

连接,但不适用于https连接。


这是通过http发送短信的代码,效果很好。

你能帮助/或者你知道一个很好的PHP教程/网站和

ssl ???


thanx,

marcus

< ;?

$ user =" user";

$ password =" password";

$ api_id =" xxxx";

$ baseurl =" http://api.clickatell.com" ;;

$ text = urlencode (这是一个示例消息);

$ to =" 0123456789" ;;

// auth call

$ url = " $ baseURL时/ HTTP / auth用户= $用户安培;密码= $密码&安培; api_id = $ api_id" ;

//做auth调用

$ ret = file($ url);

//拆分我们的回复。返回字符串位于数据的第一行

返回

$ sess = split(":",$ ret [0]);

if($ sess [0] ==" OK"){

$ sess_id = trim($ sess [1]); //删除任何空格

$ 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>消息ID:"。 $ send [1];

else

echo" send message failed";

} else {

echo认证失败:。 $ ret [0];

退出();

}

?>

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=$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
$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";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>

推荐答案

user =" user" ;;
user = "user";


password =" password" ;;
password = "password";


api_id =" xxxx";
api_id = "xxxx";


这篇关于通过SSL连接发送短信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆