Wednesday, 21 August 2013

I can't get the image URL from the server API Instagram

I can't get the image URL from the server API Instagram

All Hello! Respected community, help please, can't understand why a
properly composed query to the server API Instagram in response, I can't
get the image URL. Use this plugin. Here is his description.
Example of my query:
<?php
session_start();
require_once 'Instagram.php';
$config = array(
'client_id' => '', // Your client id
'client_secret' => '', // Your client secret
'grant_type' => 'authorization_code',
'redirect_uri' => '', // The redirect URI you provided when
signed up for the service
);
// Instantiate the API handler object
$instagram = new Instagram($config);
$accessToken = $instagram->getAccessToken();
$_SESSION['InstagramAccessToken'] = $accessToken;
$instagram->setAccessToken($_SESSION['InstagramAccessToken']);
$searching = $instagram->getUser(476198939);
print_r($searching);
// After getting the response, let's iterate the payload
$response = json_decode($searching, true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<title>Instagram API PHP Implementation demo // Popular Media</title>
</head>
<body>
<h1>Popular Media</h1>
<?
foreach ($response['data'] as $data) {
$standard_resolution =
$data['images']['standard_resolution']['url'];
?>
<div class="photo">
<img src="<?= $standard_resolution ?>" /></a>
</div>
<?
}
?>
</body>
</html>
<?php die(); ?>
In response I get this:

I did not see in the array URL of the image, although I am using the
correct function:
/**
* Get basic information about a user.
* @param $id
*/
public function getUser($id) {
$endpointUrl = sprintf($this->_endpointUrls['user'], $id,
$this->getAccessToken());
$this->_initHttpClient($endpointUrl);
return $this->_getHttpClientResponse();
}
Ìaking the request to the desired point. Here is how to obtain the images,
but works here using the ZEND framework, and I have without it. What am I
doing wrong, please help!

No comments:

Post a Comment