Catching exceptions from Guzzle

前端 未结 8 1769
情歌与酒
情歌与酒 2020-11-30 22:07

I\'m trying to catch exceptions from a set of tests I\'m running on an API I\'m developing and I\'m using Guzzle to consume the API methods. I\'ve got the tests wrapped in a

8条回答
  •  失恋的感觉
    2020-11-30 22:53

    You need to add a extra parameter with http_errors => false

    $request = $client->get($url, ['http_errors' => false]);
    

提交回复
热议问题