Created
January 6, 2014 08:05
-
-
Save mgng/8279688 to your computer and use it in GitHub Desktop.
instagram get data sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = json_decode( file_get_contents( "http://instagram.com/parishilton/media" ) ); | |
if ( ! isset( $json->status ) || $json->status !== 'ok' ) { | |
exit('error'); | |
} | |
foreach( $json->items as $item ) { | |
$data = array( | |
'username' => $item->user->username, | |
'full_name'=> $item->user->full_name, | |
'link' => $item->link, | |
'created_time' => $item->created_time, | |
'thumbnail_url' => $item->images->thumbnail->url, | |
'caption' => isset( $item->caption->text ) ? $item->caption->text : null, | |
); | |
print_r( $data ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment