Skip to content

Instantly share code, notes, and snippets.

@webchick
Created August 23, 2014 05:58
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webchick/e1900c641ffc6dac6cfc to your computer and use it in GitHub Desktop.
Save webchick/e1900c641ffc6dac6cfc to your computer and use it in GitHub Desktop.
8-line Guzzle script to read D8 REST API
<?php
require_once __DIR__ . '/core/vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->get('http://example.com/node/1', array(
'headers' => array('Accept' => 'application/hal+json')
));
print_r($response->json());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment