bloginfo

Get Instagram Id

Aug 18th, 2019 (edited)
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.40 KB | None | 0 0
  1. <?php
  2. /*
  3. Author : Denis Szalkowski Copyright (C) http://ww.dsfc.net
  4. Licence : GNU General Public Licence 3.0
  5.  
  6. L'objet de ce code est, par scrapping, en utilisant les expressions régulières, de récupérer votre ID Instagram  à partir de la page de votre profil https://www.instagram/bloginfo/.
  7.  
  8. Après l'avoir copié sur un serveur Apache ou Nginx exécutant PHP, il s'utilise de la façon suivante :
  9.  
  10. https://www.dsfc.net/instaid.php?profile=bloginfo
  11.  
  12. */
  13.   function file_get_contents_ssl($url)
  14.   {
  15.     $headers=array(
  16.       'Content-type:text/html;charset="utf-8"',
  17.       'Accept: text/html',
  18.     );
  19.     $ch=curl_init();
  20.     curl_setopt($ch,CURLOPT_HEADER,false);
  21.     curl_setopt($ch,CURLOPT_REFERER,'');
  22.     curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  23.     curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Android 9.0; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0');
  24.     curl_setopt($ch,CURLOPT_URL,$url);
  25.     curl_setopt($ch,CURLOPT_SSLVERSION,0);
  26.     curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
  27.     $html=curl_exec($ch);
  28.     curl_close($ch);
  29.     return $html;
  30.   }
  31.   $profile='bloginfo';
  32.   if(isset($_GET['profile']))
  33.   {
  34.     $profile=$_GET['profile'];
  35.   }
  36.   $url='https://www.instagram.com/'.$profile.'/';
  37.   $html=file_get_contents_ssl($url);
  38.   if(preg_match_all('@"logging_page_id":"profilePage_([0-9]+)"@i',$html,$matches,PREG_PATTERN_ORDER))
  39.   {
  40.     echo $matches[1][0];
  41.   }
  42.   exit;
  43. ?>
Add Comment
Please, Sign In to add comment