Class 'Guzzle\Http\Client' not found

我们两清 提交于 2019-12-23 10:28:31

问题


I am trying to follow up on this tutorial on sitepoint http://www.sitepoint.com/guzzle-php-http-client/ , I followed the installation step by step here http://docs.guzzlephp.org/en/latest/overview.html#installation and I'm trying to run the first simple example, but its giving me issue. I also checked my PHP version requirements(5.5): Mine is 5.6, so thats Ok.

I am using a MAC, See my code below.

error_reporting(E_ALL);
ini_set('display_errors', 1);

require_once 'vendor/autoload.php';

use Guzzle\Http\Client;
use Guzzle\Http\EntityBody;
use Guzzle\Http\Message\Request;
use Guzzle\Http\Message\Response;

$client = new Client("https://qrng.anu.edu.au");

$request = $client->get('/API/jsonI.php?length=10&type=uint8');

$response = $request->send();

echo $body = $response->getBody(true);

Please, what am i missing out?


回答1:


It is,

use GuzzleHttp\Client;

It seems your following tutorial which is based on Guzzle 3.7 and You have installed Guzzle 6.

Learn more.



来源:https://stackoverflow.com/questions/34941668/class-guzzle-http-client-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!