情诗网 >情话短信 > 正文

短信验证码

来源:情诗网    2021-02-18    分类:情话短信

public function index() {
$sn = "账号";

    $pwd = "加密后的密码";
    
    $mobile = '手机号';
    
    $content = '您好,感谢注册该软件,请输入手机验证码12345【group401】';
    
    $ext = '';
    
    $rrid = '';
    
    $stime = '';
    
    $stype = 1;
    
    $ssafe = 1;
    
    $scode = 1; // 1表示UTF-8,2表示GB2312
    
    $MARK = "|";
    
    $Md5key = "dfg78er";
    
    $Md5Sign = md5 ( $sn . $MARK . $pwd . $MARK . $mobile . $MARK . $content . $MARK . $ext . $MARK . $rrid . $MARK . $stime . $MARK . $stype . $MARK . $ssafe . $MARK . $scode . $MARK . $Md5key );
    
    $target = "http://你的sdk网址";
    
    $subdate = "sn=" . $sn . "&pwd=" . $pwd . "&Md5Sign=" . $Md5Sign . "&mobile=" . $mobile . "&content=" . urlencode ( $content ) . "&ext=" . $ext . "&stime=" . $stime . "&rrid=" . $rrid . "&stype=" . $stype . "&ssafe=" . $ssafe . "&scode=" . $scode;
    
    $sendMsgID = $this->SudasSmsPost ( $target, $subdate );
    
    if ($sendMsgID > 1) {
        echo '短信发送成功 请查收 返回值' . $sendMsgID;
    } else {
        
        echo '短信发送失败,请根据返回值查看相关错误问题 返回值' . $sendMsgID;
    }
}
public function SudasSmsPost($url, $request) {
    $output = true;
    
    $show_header = false;
    
    $ch = curl_init ();
    
    curl_setopt ( $ch, CURLOPT_URL, $url );
    
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $request ); // 发送的数据
    
    curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, $output ); // 设定返回的数据是否自动显示
    
    curl_setopt ( $ch, CURLOPT_HEADER, $show_header ); // 设定是否显示头信息
    
    $ReturnData = curl_exec ( $ch );
    
    curl_close ( $ch );
    
    return $ReturnData;
}

热门文章