Tosin Onikute
Tosin Onikute

Reputation: 4002

Class 'Guzzle\Http\Client' not found

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?

Upvotes: 7

Views: 13701

Answers (1)

pinkal vansia
pinkal vansia

Reputation: 10330

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.

Upvotes: 9

Related Questions