如何在php中使用http头发送帖子数据?

时间:2015-09-30 11:22:52

标签: php angularjs rest http-headers restful-authentication

    private function reset_pwd_confirm(){
        if($this->get_request_method() != "GET"){
            $this->response('',406);
        }
        $data = json_decode(file_get_contents("php://input"),true);
        $verification_id = $this->_request['verification_id']; 
        $user_id = $this->_request['user_id']; 
        if(!empty($verification_id) && !empty($user_id) && $user_id > 0){
            if(md5($user_id) == $verification_id){                                       
                header("Location: http://localhost:3000/#/reset?user_id=".$user_id);
                exit();                
            }else{
                $success = array('status' => "Failed", "msg" => "Not confirmed.");
                $this->response($this->json($success),404);
            }
        }else{
            $success = array('status' => "Failed", "msg" => "Invaild verification or user id.");
            $this->response($this->json($success),404);
        }

    }        

我正在处理Restful apis,以下api用于密码重置确认,确认后api应重定向到“位置:http://localhost:3000/#/reset {user_id:“5” }通过post方法重新输入密码并使用此ID提交。

如何解决这个问题? 感谢。

0 个答案:

没有答案