-1

I want to get Biography from Instagram Account.. I found this- Getting basic information from Instagram using PHP

$raw = file_get_contents('https://www.instagram.com/USERNAME'); //replace with user
preg_match('/\"followed_by\"\:\s?\{\"count\"\:\s?([0-9]+)/',$raw,$m);
print intval($m[1]);

But, I don't really know how to edit it to get bio. Any help would be really appreciated!

u_mulder
  • 54,101
  • 5
  • 48
  • 64
Ronald1i
  • 3
  • 1

1 Answers1

0

Try this regex:

user": ({"biography": ".*?")

Complete code in PHP

$raw = file_get_contents('https://www.instagram.com/USERNAME'); //replace with user
preg_match('/user": ({"biography": ".*?")/',$raw,$m);
$array = json_decode($m[1].'}', true);
echo $array['biography'];

Make sure to have utf-8 encoding for your page

<meta charset="utf-8">
Ibrahim
  • 6,006
  • 3
  • 39
  • 50
  • It works perfectly! But, for example in- https://www.instagram.com/google/ along with bio, it shows something like \u2014 , so, is it possible to remove it? Thanks! – Ronald1i Oct 29 '17 at 16:15
  • Thank you so much! It works perfectly! :) Thanks once again! :) – Ronald1i Oct 30 '17 at 03:47