Created
October 17, 2017 13:16
-
-
Save marcosnakamine/dca81e4f52afd49df64c7b004e635b63 to your computer and use it in GitHub Desktop.
PHP - Get Instagram images with file_get_contents
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 $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 ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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