-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrabimage.php
More file actions
35 lines (29 loc) · 952 Bytes
/
grabimage.php
File metadata and controls
35 lines (29 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
function processURL($url)
{
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => 2
));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$tag = '99points';
$client_id = "4db1fe9f4eda46f39f5ca8f65cbe99be";
$url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id='.$client_id;
$all_result = processURL($url);
$decoded_results = json_decode($all_result, true);
var_dump( $decoded_results);
// echo '<pre>';
// print_r($decoded_results);
// exit;
//Now parse through the $results array to display your results...
foreach($decoded_results['data'] as $item){
$image_link = $item['images']['thumbnail']['url'];
echo '<img src="'.$image_link.'" />';
}
?>