Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1.     /**
  2.      * @param $username string
  3.      * @param $isLink boolean
  4.      * @return bool
  5.      */
  6.     public static function getUserInfoRequest($username, $isLink = false)
  7.     {
  8.         if (strpos($username, self::WEB_INSTAGRAM_URL . '/') !== false) {
  9.             $username = str_replace(self::WEB_INSTAGRAM_URL . '/', '', $username);
  10.  
  11.             if (strpos($username, '/') !== false) {
  12.                 $username = explode('/', $username)[0];
  13.             }
  14.         }
  15.  
  16.         $link = self::WEB_INSTAGRAM_URL . '/' . $username . '/?__a=1';
  17.  
  18.         $content = self::_request($link);
  19.  
  20.         try {
  21.             $content = json_decode($content, true);
  22.         } catch (Exception $e) {
  23.             return false;
  24.         }
  25.  
  26.         if (!isset($content['user'])) {
  27.             return false;
  28.         }
  29.  
  30.         return $content['user'];
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement