Skip to content

Instantly share code, notes, and snippets.

@apoca
Created June 8, 2015 12:15
Show Gist options
  • Save apoca/a9666ba74ef4625fcce7 to your computer and use it in GitHub Desktop.
Save apoca/a9666ba74ef4625fcce7 to your computer and use it in GitHub Desktop.
client http apigility
$client = new Client([
'base_uri' => 'http://esolidar-api',
'headers' => ['Accept' => 'application/json'],
]);
$headers = ['Content-type' => 'application/json; charset=UTF-8', 'Accept' => 'application/json'];
$body = json_encode(array('username' => $params['username'], 'password' => $params['password']));
$request = new Request('POST', 'http://esolidar-api/users/auth', $headers, $body);
$response = $client->send($request, ['timeout' => 2000000]);
//$response = new Response();
//echo "corpo: ".$response->withBody();
print_r($response);
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment