使用guzzleHttp爬取数据(无验证码版)

2019-08-05 10:55:37   php分享记录

 

  1. $client = new Client(['cookies'=>true]);
  2. $client->request("POST","https://10.0.109.26/goform/IADIdentityAuth",[
  3. 'verify' => false,
  4. "headers"=>[
  5. "Content-Type"=>'application/x-www-form-urlencoded',
  6. 'Content-Length'=>26,
  7. ],
  8. 'form_params'=>[
  9. "username"=>"admin",
  10. "password"=>"admin"
  11. ]
  12. ]);
  13. $info = $client->get("https://10.0.109.26/HBSimInfo.htm?timestamp=".time(),[
  14. 'verify' => false,
  15. ]);
  16. return json_decode($info->getBody());