Skip to content

Instantly share code, notes, and snippets.

@marcosnakamine
Created October 17, 2017 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcosnakamine/dca81e4f52afd49df64c7b004e635b63 to your computer and use it in GitHub Desktop.
Save marcosnakamine/dca81e4f52afd49df64c7b004e635b63 to your computer and use it in GitHub Desktop.
PHP - Get Instagram images with file_get_contents
<?php $instagram = json_decode( file_get_contents( 'https://www.instagram.com/user_name/media/' ) ) ?>
<?php for ( $i=0; $i<4; $i++ ): ?>
<a href="https://www.instagram.com/p/<?php echo $instagram->items[$i]->code ?>" target="_blank"><img src="<?php echo $instagram->items[$i]->images->low_resolution->url ?>" alt=""></a>
<?php endfor ?>
@ArpitTiwari1999
Copy link

ArpitTiwari1999 commented Sep 16, 2018

It replies with the following command :
Warning: file_get_contents(https://www.instagram.com/my_account/media/): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment