<?php
$_GET['link']=$_POST['link'];
if(!empty($_GET['link'])){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.instagram.com/oembed/?url='.$_GET['link'].'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: text/html, application/xml, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;', 'Accept-Language: ru, en, *;', 'Accept-Charset: iso-8859-1, utf-8, utf-16, *;', 'Accept-Encoding: identity;', 'Connection: close'));
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)');
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_AUTOREFERER, 0);
curl_setopt($ch, CURLOPT_REFERER, 'http://instagram.com/');
$x= curl_exec($ch);
$json=json_decode($x);
if($json->author_name==''){
$melumat=0;
}else{
$melumat=1;
}
if($melumat==0){
echo '<div class="l1" style="text-align:center;">
<img src="404.gif" alt="404" width="160" height="100"/></div>';
}else{
echo '<table><tr>
<td width="1%"><img src="'.$json->thumbnail_url.'" alt="" width="80" height="80" style="border-radius:10px;"></td>
<td width="99%">
» <b>Поделился:</b> <a href="https://instagram.com/'.$json->author_name.'">@'.$json->author_name.'</a><br/>
» <a href="https://www.facebook.com/sharer/sharer.php?u='.$json->thumbnail_url.'" target="_blank">Поделиться на Facebook</a><br/>
» <a href="'.$json->thumbnail_url.'" target="_blank">Скачать (Бесплатно)</a><br/>
</td>
</tr></table>';
}
}
?>