$requestUrl = "http://sms.webchinese.cn/web_api/?" ; //接口地址 $par = array ( 'Uid' => "yijiabao" , 'Key' => "c4321d062b3688bc2a13" , 'smsMob' => $phone , 'smsText' => iconv( "UTF-8" , "GBK" , $code ), ); $url = $requestUrl . http_build_query( $par ); $res = do_post( $url , array ()); if ( $res >0){ return array ( 'status' => 0, "" , 'msg' => "SUCESS" ); } else { switch ( $res ) { case -1: $msg = "没有该用户账户" ; break ; case -2: $msg = "密钥不正确" ; break ; case -3: $msg = "短信数量不足" ; break ; case -11: $msg = "该用户被禁用" ; break ; case -4: $msg = "手机号格式不正确" ; break ; case -41: $msg = "手机号码为空" ; break ; case -42: $msg = "短信内容为空" ; break ; case -51: $msg = "短信签名格式不正确" ; break ; default : $msg = "未知错误" ; break ; } } return array ( 'status' => 1, "" , 'msg' => $msg ); |