Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class 'Guzzle\Http\Client' not found

Tags:

php

guzzle

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?

like image 227
Tosin Onikute Avatar asked Jan 22 '16 07:01

Tosin Onikute


1 Answers

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.

like image 172
pinkal vansia Avatar answered Sep 30 '22 06:09

pinkal vansia