Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $userid = ''; // userid
- $token = ''; // token access
- $count = ''; // wie viele auslesen
- function fetchData($url){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- $result = fetchData("https://api.instagram.com/v1/users/$userid/media/recent/?access_token=$token&count=$count");
- $result = json_decode($result);
- if(isset($result))
- {
- foreach ($result->data as $post) {
- if(empty($post->images->low_resolution->url)) {
- // Do Nothing
- }
- else {
- ?>
- <img src="<?php echo
- $post->images->low_resolution->url ?>" alt="<?php echo $post->caption->text
- ?>"/>
- <?php
- }
- }
- }else{
- echo "Die User ID oder der Token ist Falsch!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement