首页 > 编程语言 > php > php调用创蓝短信平台接口
2013
07-08

php调用创蓝短信平台接口

<?
//require "../../core/core.php";
//defined("ROOT") or exit;

if($phone = $_POST['desmobile'] and $content = $_POST['sms']){
    $ip = "219.235.4.168";
    $account = urlencode("youruser");
    $pswd = urlencode("yourpassword");
    //$content = iconv("GB2312","UTF-8",$content);
    $url = "http://$ip/msg/HttpPkgSM";
    $postData = "account=$account&pswd=$pswd&msg=$phone|$content&needstatus=true";
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
    $data = curl_exec($ch);
    curl_close($ch);
    $result = explode(",",$data);
    if($result and $result[1]==0){
    	echo "发送成功";
    }
    else{
    	echo "发送失败,请联系管理员";
    }
}
?>
最后编辑:
作者:NINE
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。