如何解决:Http Post请求可以在邮递员上工作,但不能在Laravel httpGuzzle上工作

时间:2019-05-19 12:02:58

标签: laravel postman guzzlehttp

我从laravel GuzzleHttp发出POST Http请求时遇到问题,在邮递员上工作正常

$client = new Client(['headers'=>[
            'postman-token' => 'e0dab38d-d4a8-14d2-a28b-cbfae86f9d3a',
            'cache-control' => 'no-cache',
            'accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
            'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...6',
            'content-type' => 'application/x-www-form-urlencoded',
            'upgrade-insecure-requests' => '1',
            'origin' => 'https://apolo.test.com.coy'
        ]]);

$body =            
        [       
            'PasswordTextBox'=>'XXXXXXXXXX',
            'RadScriptManager1_TSM'=>';;System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf...d2',
            'SubmitButton'=>'Login',
            'UsernameTextBox'=>'UUUUUUU',
            '__EVENTARGUMENT'=>"",
            '__EVENTTARGET'=>"",
            '__EVENTVALIDATION'=>'Ian45PZ4GNvGqnQgcQqa6KYZTb...7qStUB8=',
            '__VIEWSTATE'=>'jrClIU1...J1m7Zfe8=',
            '__VIEWSTATEGENERATOR'=>'C2EABB'
        ];



        $response = $client->post('http://apolo.test.com.coy/Login.aspx', 
                ['form_params' =>$body]
        );

我正在尝试登录某个网站,但它总是使我回到登录页面本身

所以我得到的登录页面本身不是必需的页面

0 个答案:

没有答案