急!急!急!我的php接口文档出错了,不知道什么原因,下面这段代码哪里错了,请高手指教,谢谢!!! 10
functionsend_sms($mobile,$message,$word=0,$time=0){global$db,$DT,$DT_TIME,$DT_IP,$_us...
function send_sms($mobile, $message, $word = 0, $time = 0) {
global $db, $DT, $DT_TIME, $DT_IP, $_username;
if(!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) return false;
$word or $word = word_count($message);
$sms_message = rawurlencode(convert($message, DT_CHARSET, 'UTF-8'));
$data = 'sms_uid='.$DT['sms_uid'].'&sms_key='.$DT['sms_key'].'&sms_charset='.DT_CHARSET.'&sms_mobile='.$mobile.'&sms_message='.$sms_message.'&sms_time='.$time;
$header = "POST nd.php HTTP/1.0\r\n";
$header .= "Accept: */*\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: ".strlen($data)."\r\n\r\n";
$fp = fsockopen('sms.destoon.com', 8820);
$code = '';
if($fp) {
fputs($fp, $header.$data);
while(!feof($fp)) {
$code .= fgets($fp, 1024);
}
fclose($fp);
//log_write($code, 'sms');
if($code && strpos($code, 'destoon_sms_code=') !== false) {
$code = explode('destoon_sms_code=', $code);
$code = $code[1];
} else {
$code = 'Can Not Connect SMS Server';
}
} else {
$code = 'Can Not Connect SMS Server';
}
$db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");
return $code;
} 展开
global $db, $DT, $DT_TIME, $DT_IP, $_username;
if(!$DT['sms'] || !$DT['sms_uid'] || !$DT['sms_key']) return false;
$word or $word = word_count($message);
$sms_message = rawurlencode(convert($message, DT_CHARSET, 'UTF-8'));
$data = 'sms_uid='.$DT['sms_uid'].'&sms_key='.$DT['sms_key'].'&sms_charset='.DT_CHARSET.'&sms_mobile='.$mobile.'&sms_message='.$sms_message.'&sms_time='.$time;
$header = "POST nd.php HTTP/1.0\r\n";
$header .= "Accept: */*\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: ".strlen($data)."\r\n\r\n";
$fp = fsockopen('sms.destoon.com', 8820);
$code = '';
if($fp) {
fputs($fp, $header.$data);
while(!feof($fp)) {
$code .= fgets($fp, 1024);
}
fclose($fp);
//log_write($code, 'sms');
if($code && strpos($code, 'destoon_sms_code=') !== false) {
$code = explode('destoon_sms_code=', $code);
$code = $code[1];
} else {
$code = 'Can Not Connect SMS Server';
}
} else {
$code = 'Can Not Connect SMS Server';
}
$db->query("INSERT INTO {$db->pre}sms (mobile,message,word,editor,sendtime,code) VALUES ('$mobile','$message','$word','$_username','$DT_TIME','$code')");
return $code;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询