<?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);
}