NewSmsServer.php 912 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace crmeb\services;
  3. class NewSmsServer
  4. {
  5. const url = 'https://api-shss.zthysms.com/v2/sendSms';
  6. private static $username = 'xisiyan';
  7. private static $password = 'CX2%W@o$UYlk2tSd';
  8. private static $sign = '高新区狮山熙思研美容中心';
  9. public static function send($phone,$code)
  10. {
  11. // var_dump($phone,$code);
  12. $data['username'] = self::$username;
  13. $data['tKey'] = time();
  14. $data['password'] = md5(md5(self::$password).$data['tKey']);
  15. $data['mobile'] = $phone;
  16. $sign = self::$sign;
  17. $data['content'] = "【{$sign}】您的验证码是:{$code},请不要把验证码泄露给其他人。";
  18. $rs = do_request(self::url,$data,[
  19. 'Content-Type: application/json'
  20. ],true,true,0);
  21. // var_dump($data);
  22. $rs = json_decode($rs,true);
  23. // var_dump($rs);
  24. return $rs;
  25. }
  26. }