Пример #1
0
                $hash .= $chars[mt_rand(0, $max)];
            }
        }
        return $hash;
    }
    public function send()
    {
        $target = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";
        $mobile = $this->mobile;
        $mobile_code = $this->random(4, 1);
        if (empty($mobile)) {
            exit('手机号码不能为空');
        }
        $account = $this->account;
        $password = $this->password;
        $content = $this->content;
        $post_data = "account={$account}&password={$password}&mobile={$mobile}&content=" . rawurlencode($content);
        $gets = $this->xml_to_array($this->Post($post_data, $target));
        echo $gets['SubmitResult']['msg'] . "!";
    }
    public function testSend()
    {
        $mobile_code = $this->random(4, 1);
        $content = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。";
        $sender = new SMS($this->account, $this->password, $this->mobile, $content);
        $sender->send();
    }
}
$x = new SMS("cf_lidaqi", "15155672782", "18580468684", "asd");
$x->testSend();