Answer the question
In order to leave comments, you need to log in
How to save image meta data from Instagram API?
I get a list of images by tag from Instagram.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.instagram.com/v1/tags/My_tages_here/media/recent?access_token=YOUR_TOKEN&count=20");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
$jsonData = json_decode($output);
curl_close($ch);
$tags = "";
for($j=0; $j<count($jsonData->data[0]->tags); $j++)
{
if($j!=0) $tags .= ", ";
$tags .= "#".$jsonData->data[0]->tags[$j];
}
for($j=0; $j<count($jsonData->data); $j++){
if(!empty($jsonData->data[$j]->images->standard_resolution->url)){
echo '<div class="cls_img">
<a href="'.$jsonData->data[$j]->link .'" target="_blank">
<div class="img">
<img src="'. $jsonData->data[$j]->images->standard_resolution->url .'">
</div>
<div class="info" id="heading0">
<h3>
' . $tags .'
</h3>
<p>'. $jsonData->data[$j]->caption->text.'</p>
</div>
</a>
</div>';
}
}
Answer the question
In order to leave comments, you need to log in
Check what is saved by the user and just insert into the database, of course you don’t need to shove the photo there, it will go to the folder, but the link to the photo (on your resource) will go to the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question