protected function InstagramBlockBlock::_fetchData in Instagram Block 8
Sends a http request to the Instagram API Server
Parameters
string $url: URL for http request.
Return value
bool|mixed The encoded response containing the instagram images or FALSE.
1 call to InstagramBlockBlock::_fetchData()
- InstagramBlockBlock::build in src/
Plugin/ Block/ InstagramBlockBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ InstagramBlockBlock.php, line 225 - Contains \Drupal\instagram_block\Plugin\Block\InstagramBlockBlock.
Class
- InstagramBlockBlock
- Provides an Instagram block.
Namespace
Drupal\instagram_block\Plugin\BlockCode
protected function _fetchData($url) {
try {
$response = $this->httpClient
->get($url, array(
'headers' => array(
'Accept' => 'application/json',
),
));
$data = json_decode($response
->getBody(), TRUE);
if (empty($data)) {
return FALSE;
}
return $data;
} catch (RequestException $e) {
return FALSE;
}
}