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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With