Im trying to convert this url https://api.instagram.com/v1/users/self/?access_token=123456789
Into something I can use with guzzle. So far I've got:
$token = "123456789";
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'https://api.instagram.com/v1/users/self/', [
'access_token' => $token
]);
echo $res->getStatusCode();
// 200
echo $res->getHeaderLine('content-type');
// 'application/json; charset=utf8'
echo $res->getBody();
// {"type":"User"...'
but I just get an error that reads:
Client error: `GET https://api.instagram.com/v1/users/self/` resulted in a `400 BAD REQUEST` response:
{"meta": {"error_type": "OAuthParameterException", "code": 400, "error_message": "Missing client_id or access_token URL (truncated...)
You should place your token in query
like this:
$client = new \GuzzleHttp\Client;
$response = $client->get('https://api.instagram.com/v1/users/self/', [
'query' => [
'access_token' => $token
]
]);
return $response->getBody();