您的位置:首页 > 编程语言

短信API,各种语言的源代码!支持长短信,支持回复!!!

2012-03-20 00:00 567 查看
<?php

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;
}
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息