-
-
Save weaverryan/345eb639a403b18afad2 to your computer and use it in GitHub Desktop.
Guzzle update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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