PHP示例一
<%?php header("Content-Type: text/html; charset=utf-8"); 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; } $target = "http://sms.106jiekou.com/utf8/sms.aspx"; //替換成自己的賬號(hào)和接口密碼 $post_data = "account=帳號(hào)&password=接口密碼&mobile=手機(jī)號(hào)碼&content=".rawurlencode("您的訂單編碼:4557。如需幫助請(qǐng)聯(lián)系客服。"); echo $gets = Post($post_data, $target); //請(qǐng)自己解析$gets字符串并實(shí)現(xiàn)自己的邏輯 //100 表示成功,其它的參考文檔 ?>
PHP示例二
<%?php header("Content-Type: text/html; charset=utf-8"); function Post($curlPost,$url){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_NOBODY, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost); $return_str = curl_exec($curl); curl_close($curl); return $return_str; } $target = "http://sms.106jiekou.com/utf8/sms.aspx"; //替換成自己的賬號(hào)和接口密碼 $post_data = "account=帳號(hào)&password=接口密碼&mobile=手機(jī)號(hào)碼&content=".rawurlencode("您的訂單編碼:4557。如需幫助請(qǐng)聯(lián)系客服。"); echo $gets = Post($post_data, $target); //請(qǐng)自己解析$gets字符串并實(shí)現(xiàn)自己的邏輯 //100 表示成功,其它的參考文檔 ?>
友情鏈接:106短信平臺(tái) | 發(fā)短信平臺(tái) | 短信接口平臺(tái) | 短信接口平臺(tái)哪個(gè)好 | 國(guó)際短信 | 短信通 | 短信接口應(yīng)用
關(guān)于我們 | 產(chǎn)品與服務(wù) | 解決方案 | 客戶案例 | 聯(lián)系我們 | 幫助指南 | 付款方式
Copyright © 2008-2018 短信通 . 速度網(wǎng)絡(luò)有限公司 短信接口應(yīng)用第一平臺(tái) All rights reserved. 浙ICP備10040624號(hào)-2