56短信网致力于为您提供安全,快捷,高效的短信接口服务,以下是discuz调用56短信网接口,如果您在接入中遇到什么问题,可以随时联系我们技术人员或由我们技术人员帮您完成调试。
//构造要post的字符串
$params = "";
foreach ($messageArgv as $key => $value) {
if ($flag != 0) {
$params.= "&";
$flag = 1;
}
$params.= $key . "=";
$params.= urlencode($value);
$flag = 1;
}
$length = strlen($params);
//创建socket连接
$fp = fsocketopen("jiekou.56dxw.com", 8061, &$errno, &$errstr, $timeout = 10);
//构造post请求的头
$header = "POST /WebServiceInterface.asmx/mdsmssend HTTP/1.1\r\n";
$header.= "Host:sdk.entinfo.cn\r\n";
$header.= "Content-Type: application/x-www-form-urlencoded\r\n";
$header.= "Content-Length: " . $length . "\r\n";
$header.= "Connection: Close\r\n\r\n";
//添加post的字符串
$header.= $params . "\r\n";
//发送post的数据
fputs($fp, $header);
$inheader = 1;
while (!feof($fp)) {
$line = fgets($fp, 1024); //去除请求包的头只显示页面的返回数据
if ($inheader && ($line == "\n" || $line == "\r\n")) {
$inheader = 0;
}
}
$line = str_replace("<string xmlns=\"http://tempuri.org/\">", "", $line);
$line = str_replace("</string>", "", $line);
$result = explode("-", $line);
include template('common/header_ajax');
if (count($result) > 1) {
echo 'error|'.lang('plugin/tshuz_regphonecode', 'lang01');
}else{
echo 'success|'.lang('plugin/tshuz_regphonecode', 'lang02');
}
include template('common/footer_ajax');
exit;
?>
56短信网,最好的短信接口提供商。