Skip to content

Instantly share code, notes, and snippets.

@mgng
Created January 6, 2014 08:05
Show Gist options
  • Save mgng/8279688 to your computer and use it in GitHub Desktop.
Save mgng/8279688 to your computer and use it in GitHub Desktop.
instagram get data sample
<?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