Browse Source

移动云短信

lizhen_gitee 6 months ago
parent
commit
cc1e0a8c9e
1 changed files with 26 additions and 0 deletions
  1. 26 0
      application/api/controller/Demo.php

+ 26 - 0
application/api/controller/Demo.php

@@ -22,6 +22,32 @@ class Demo extends Api
     // 无需鉴权的接口,*表示全部
     protected $noNeedRight = ['test2'];
 
+    //移动云短信
+    public function yidong_sms(){
+        $mobile = '18560505277';
+        $content = '【淮安达富居家养老】您的短信验证码是1234,五分钟内有效';
+        $url = 'https://112.35.1.155:443/sms/submit';
+        $data = [
+            'ecName' => '江苏达富居家养老健康管理有限公司',
+            'apId' => 'dafuhttps',
+            'secretKey' => '&YY4vrJb',
+            'mobiles' => $mobile,
+            'content' => $content,
+            'sign' => 'YV61594FE',
+            'addSerial' => '',
+        ];
+
+        $mac = md5(join('',$data));
+        $data['mac'] = $mac;
+        unset($data['secretKey']);
+
+        $header = ["Content-Type:application/json;charset=UTF-8"];
+        $rs = curl_post($url,base64_encode(json_encode($data)),$header);
+        dump($rs);
+
+        $secretKey = '&YY4vrJb';
+    }
+
     /**
      * 测试方法
      *