标签:
<?php require ‘../vendor/autoload.php‘; use GuzzleHttp\Client; use \Symfony\Component\VarDumper\VarDumper; $client = new Client(); $url = "http://localhost/symfony2/web/app_dev.php/test/guzz"; try{ $response = $client->get($url); var_dump($response); } catch (\GuzzleHttp\Exception\ClientException $exception) { $responseBody = $exception->getResponse()->getBody()->getContents(); //$responseBody = $exception->getResponse()->getBody(true);有的版本可能是这样 VarDumper::dump($responseBody); }
Guzzle Http 使用 返回 非 200 状态 抛出异常
标签:
原文地址:http://my.oschina.net/u/729139/blog/424541