PHP网站短信接口源代码
长沙优客易通科技有限公司 br / a href=http://www.smsyouke.com target=_blank rel=nofollowwww.smsyouke.combr / /a欢迎技术沟通或者测试QQ:250041295 br / 支持长短信,回复,状态查询,实现验证码1-3秒收到
长沙优客易通科技有限公司
www.smsyouke.com
欢迎技术沟通或者测试QQ:250041295
支持长短信,回复,状态查询,实现验证码1-3秒收到
www.smsyouke.com
欢迎技术沟通或者测试QQ:250041295
支持长短信,回复,状态查询,实现验证码1-3秒收到
function Post($data, $target) {
$url_info = parse_url($target);
$httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n";
$httpheader .= "Host:" . $url_info['host'] . "\r\n";
$httpheader .= "Content-Type:application/x-www-form-urlencoded\r\n";
$httpheader .= "Content-Length:" . strlen($data) . "\r\n";
$httpheader .= "Connection:close\r\n\r\n";
//$httpheader .= "Connection:Keep-Alive\r\n\r\n";
$httpheader .= $data;
$fd = fsockopen($url_info['host'], 80);
fwrite($fd, $httpheader);
$gets = "";
while(!feof($fd)) {
$gets .= fread($fd, 128);
}
fclose($fd);
return $gets;
2. [代码][PHP]代码 跳至 [1] [2] [全屏预览]
include_once('sms.php');
$target = "http://10.1.120.22/SmsMmsWebService/Service.asmx/g_Submit";
//替换成自己的测试账号,参数顺序和wenservice对应
$post_data = "sname=kwsm&spwd=kwsm&scorpid=&sprdid=101&sdst=13910862579&smsg=".rawurlencode("短信内容");
//$binarydata = pack("A", $post_data);
echo $gets = Post($post_data, $target);
//请自己解析$gets字符串并实现自己的逻辑
//<State>0</State>表示成功,其它的参考文档
精彩图集
精彩文章






