NewSmsServer.php 849 B

1234567891011121314151617181920212223242526
  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. $data['username'] = self::$username;
  12. $data['tKey'] = time();
  13. $data['password'] = md5(md5(self::$password).$data['tKey']);
  14. $data['mobile'] = $phone;
  15. $sign = self::$sign;
  16. $data['content'] = "【{$sign}】您的验证码是:{$code},请不要把验证码泄露给其他人。";
  17. $rs = do_request(self::url,$data,[
  18. 'Content-Type: application/json'
  19. ],true,true,0);
  20. $rs = json_decode($rs,true);
  21. var_dump($rs);
  22. return $rs;
  23. }
  24. }