Question: I want to fetch data(the images in each post) stored in <https://www.instagram.com/explore/tags/selfie/?__a=1>, but all I get when I decode and var\_dump this is NULL.

```
$obj = json_decode("https://www.instagram.com/explore/tags/selfie/?__a=1", true);
var_dump($obj);

```

Answer: 
You're trying to `json_decode` the STRING 

`https://www.instagram.com/explore/tags/selfie/?__a=1`

What you need to do is to fetch the URL first. I suggest using [`file_get_contents`](http://php.net/manual/en/function.file-get-contents.php), which takes a URL and returns the contents at the end of that URL.

Try this:

```
$json = file_get_contents("https://www.instagram.com/explore/tags/selfie/?__a=1");
$obj = json_decode($json, true);
var_dump($obj);

```
The argument to the function json\_decode(), $html must be plaintext/string.
This should work. 

```
$url = "https://www.instagram.com/explore/tags/selfie/?__a=1";
$html = file_get_contents($url); 
$obj = json_decode($html,true);
var_dump($obj);

```

See this in action [here](https://repl.it/repls/UnselfishBlindProcedurallanguage)