|
|
@@ -34,10 +34,11 @@ class NewSMSService
|
|
|
* method: sendSmsCode
|
|
|
* param: phone - {string} 手机号
|
|
|
*/
|
|
|
- public static function send($phone, array $param, $template = "VERIFICATION_CODE")
|
|
|
+ public static function send($phone, array $param, $template = "DEFAULT")
|
|
|
{
|
|
|
$code = $param['code'];
|
|
|
- $target = "http://cf.51welink.com/submitdata/Service.asmx/g_Submit";
|
|
|
+ $target = 'http://www.qunfaduanxin.vip/api/send';
|
|
|
+// $target = "http://cf.51welink.com/submitdata/Service.asmx/g_Submit";
|
|
|
$company = '优交所';
|
|
|
switch ($template) {
|
|
|
case 'REGISTER':
|
|
|
@@ -79,8 +80,10 @@ class NewSMSService
|
|
|
|
|
|
}
|
|
|
|
|
|
- $post_data = "sname=dlycwl01&spwd=ycwl123456&scorpid=&sprdid=1012818&sdst=" . $phone . "&smsg=" . rawurlencode($content);
|
|
|
- $gets = self::post($post_data, $target);
|
|
|
+// $post_data = "sname=dlycwl01&spwd=ycwl123456&scorpid=&sprdid=1012818&sdst=" . $phone . "&smsg=" . rawurlencode($content);
|
|
|
+ $post_data = "?username=16520929823&password=" . strtoupper(md5('6520929823')) . "&gwid=c2i00vx1&mobile=" . $phone . "&message=" . $content;
|
|
|
+// $gets = self::post($post_data, $target);
|
|
|
+ $gets = do_request($target . $post_data, []);
|
|
|
@file_put_contents('sms.log', json_encode($gets), FILE_APPEND);
|
|
|
if ($gets) {
|
|
|
return ['status' => 200, 'msg' => '短信发送成功'];
|
|
|
@@ -89,31 +92,31 @@ class NewSMSService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //第三方短信平台
|
|
|
- private static 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);
|
|
|
- if ($gets != '') {
|
|
|
- $start = strpos($gets, '<?xml');
|
|
|
- if ($start > 0) {
|
|
|
- $gets = substr($gets, $start);
|
|
|
- }
|
|
|
- }
|
|
|
- return $gets;
|
|
|
- }
|
|
|
+// //第三方短信平台
|
|
|
+// private static 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);
|
|
|
+// if ($gets != '') {
|
|
|
+// $start = strpos($gets, '<?xml');
|
|
|
+// if ($start > 0) {
|
|
|
+// $gets = substr($gets, $start);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return $gets;
|
|
|
+// }
|
|
|
}
|