Skip to content

Instantly share code, notes, and snippets.

@weaverryan
Last active October 9, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaverryan/345eb639a403b18afad2 to your computer and use it in GitHub Desktop.
Save weaverryan/345eb639a403b18afad2 to your computer and use it in GitHub Desktop.
Guzzle update
<?php
require __DIR__.'/vendor/autoload.php';
use GuzzleHttp\Client;
// create our http client (Guzzle)
$client = new Client(array(
'base_uri' => 'http://localhost:8000',
'http_errors' => false,
));
$nickname = 'ObjectOrienter'.rand(0, 999);
$data = array(
'nickname' => $nickname,
'avatarNumber' => 5,
'tagLine' => 'a test dev!'
);
$response = $client->post('/api/programmers', array(
'body' => json_encode($data)
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment