小陆博客

为站长提供建站技巧、网站运营、搜索优化、建站方向以及利用网站赚钱与创业的知识与经验。

热门搜索:

短信发送

7617 浏览
0 评论
点击跳转 链接
内容
http://www.17int.com/web/API_document.html ```php public function send_mobile() { $account='账号'; $password='密码'; $sendUrl = 'http://www.17int.cn/xxsmsweb/smsapi/send.json'; $smsConf = array( 'account' => $account, 'password' => strtoupper(md5($password)), 'mobile' => $param_data['mobile'], 'requestId' => time() + rand(1000, 9999), 'content' => '【签名】'.$content ); $return = $this->juhecurl($sendUrl, json_encode($smsConf, true), 1); //请求发送短信 $shuju = json_decode($return, 1); if ($shuju['status'] == 10) { //成功 } else { //失败 $error = array(); $error['Rejected'] = '请求被拒绝'; $error['NotAuth'] = '用户密码不正确'; $error['RejeBadReqcted'] = '请求参数不正确'; $error['Charge'] = '余额不足'; return array('code' => 0, 'message' => $error[$shuju['errorCode']]); } } public function juhecurl($url, $params = false, $ispost = 0) { $headers = array( "Content-type: application/json;charset='utf-8'", 'Accept: application/json', 'Cache-Control: no-cache', 'Pragma: no-cache', ); $httpInfo = array(); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if ($ispost) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_URL, $url); } else { if ($params) { curl_setopt($ch, CURLOPT_URL, $url . '?' . $params); } else { curl_setopt($ch, CURLOPT_URL, $url); } } $response = curl_exec($ch); if ($response === false) { //echo "cURL Error: " . curl_error($ch); return false; } $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $httpInfo = array_merge($httpInfo, curl_getinfo($ch)); curl_close($ch); return $response; } ```
http://www.17int.com/web/API_document.html ```php public function send_mobile() { $account='账号'; $password='密码'; $sendUrl = 'http://www.17int.cn/xxsmsweb/smsapi/send.json'; $smsConf = array( 'account' => $account, 'password' => strtoupper(md5($password)), 'mobile' => $param_data['mobile'], 'requestId' => time() + rand(1000, 9999), 'content' => '【签名】'.$content ); $return = $this->juhecurl($sendUrl, json_encode($smsConf, true), 1); //请求发送短信 $shuju = json_decode($return, 1); if ($shuju['status'] == 10) { //成功 } else { //失败 $error = array(); $error['Rejected'] = '请求被拒绝'; $error['NotAuth'] = '用户密码不正确'; $error['RejeBadReqcted'] = '请求参数不正确'; $error['Charge'] = '余额不足'; return array('code' => 0, 'message' => $error[$shuju['errorCode']]); } } public function juhecurl($url, $params = false, $ispost = 0) { $headers = array( "Content-type: application/json;charset='utf-8'", 'Accept: application/json', 'Cache-Control: no-cache', 'Pragma: no-cache', ); $httpInfo = array(); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if ($ispost) { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_URL, $url); } else { if ($params) { curl_setopt($ch, CURLOPT_URL, $url . '?' . $params); } else { curl_setopt($ch, CURLOPT_URL, $url); } } $response = curl_exec($ch); if ($response === false) { //echo "cURL Error: " . curl_error($ch); return false; } $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); $httpInfo = array_merge($httpInfo, curl_getinfo($ch)); curl_close($ch); return $response; } ```

评论 (0)

评论功能正在开发中...