/
getInstagram.php
31 lines (20 loc) · 940 Bytes
/
getInstagram.php
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
<?php
/**This page wil return a json encoded list of instagram pictures containing username, profilepicture, text and the image (in standard resolution). Unless the user is blocked **/
require_once 'emoji/emoji.php';
require_once 'configuration.php';
require_once 'getBlocked.php';
$json = file_get_contents('https://api.instagram.com/v1/tags/'.$hashtag.'/media/recent?access_token='.$instagram_access_token);
$obj = json_decode($json, true);
foreach($obj{'data'} as $instagram ){
if(!isBlocked($instagram{'user'}{'username'})){
$instagramList[] = array("user" => $instagram{'user'}{'username'},
"profile_picture" => $instagram{'user'}{'profile_picture'},
"text" => emoji_unified_to_html($instagram{'caption'}{'text'}),
"image" => $instagram{'images'}{'standard_resolution'}{'url'});
if(sizeof($instagramList) == $maxAmount){
break;
}
}
}
echo json_encode($instagramList);
?>