How to Show Instagram feeds to your website with php
Today we learn how to show instagram feeds and posts to on your website so here is the code for show instagram feeds or posts to on your website ..
Requirements
Requirements
Access Token
Instagram ID
Instagram Account
<?php
//$userid = "1234567893"; //get this from your instagram account
//$accessToken = "798592023.85b53d1.49047a4fcd1b4aebad2e67a56f57f8cc"; //instagram account
$url = "https://api.instagram.com/v1/users/{$userid}/media/recent/?access_token={$accessToken}";
$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);
$result = json_decode($result);
?>
<ul>
<?php $i=1; foreach ($result->data as $post): ?>
<?php if($i>5){ break;} ?>
<li><a class="" href="<?php echo $post->images->standard_resolution->url ?>" data-fancybox-group="gallery" title="<?php echo $post->caption->text ?>"><img src="<?php echo $post->images->thumbnail->url ?>" width="246" height="246" alt="<?php echo $post->caption->text ?>" /></a> </li>
<?php $i++; endforeach; ?>
</ul>
</div>
Instagram ID
Instagram Account
<?php
//$userid = "1234567893"; //get this from your instagram account
//$accessToken = "798592023.85b53d1.49047a4fcd1b4aebad2e67a56f57f8cc"; //instagram account
$url = "https://api.instagram.com/v1/users/{$userid}/media/recent/?access_token={$accessToken}";
$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);
$result = json_decode($result);
?>
<ul>
<?php $i=1; foreach ($result->data as $post): ?>
<?php if($i>5){ break;} ?>
<li><a class="" href="<?php echo $post->images->standard_resolution->url ?>" data-fancybox-group="gallery" title="<?php echo $post->caption->text ?>"><img src="<?php echo $post->images->thumbnail->url ?>" width="246" height="246" alt="<?php echo $post->caption->text ?>" /></a> </li>
<?php $i++; endforeach; ?>
</ul>
</div>
Now navigate to your php page and now you can see your instagram all feeds on your webpage ...
Thank YOu
Thank YOu
Thanks for the information. It was very useful indeed.
ReplyDeleteId like to share with you this place to buy Comments on Instapromote which which is good for users to help them get more interaction and engagement through cheap and effective platforms such as Instapromote.
ReplyDelete