Skip to content

Instantly share code, notes, and snippets.

@alxy
Created October 13, 2016 17:43
Show Gist options
  • Save alxy/c6eb402fd278fd2635455550b50847d2 to your computer and use it in GitHub Desktop.
Save alxy/c6eb402fd278fd2635455550b50847d2 to your computer and use it in GitHub Desktop.
<?php
$this->client = new Client([
'base_url' => 'https://app.snipcart.com/api/',
'auth' => [
'ST_NTI3OTljM.......',
':'
],
'headers' => [
'accept' => 'application/json'
]
]);
$response = $this->client->request('GET', 'orders', ['query' => $parameters]); // This leads to a curl error (hostname could not be resolved)
// ----------------------------------------
$this->client->request('GET', 'https://app.snipcart.com/api/orders?offset=0&limit=50&status=processed', [
'auth' => [
'ST_NTI3OT.....',
':'
],
'headers' => [
'accept' => 'application/json'
]])
->getBody()->getContents();
// This works as expected, what is the difference?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment