get json data from the URL using php

advertisements

here i try to fetch json data from following url

https://www.flickr.com/services/api/render?method=flickr.places.find&api_key=xxxxx&query=$search_data&format=json&nojsoncallback=1

contain following information which i want to get according above link

{
    "places": {
        "place": [
            {
                "place_id": "Dm5SiT1TULMEIMYN",
                "woeid": "2295402",
                "latitude": 23.03,
                "longitude": 72.591,
                "place_url": "/India/Gujarat/Ahmedabad",
                "place_type": "locality",
                "place_type_id": 7,
                "timezone": "Asia/Kolkata",
                "_content": "Ahmedabad, Gujarat, India",
                "woe_name": "Ahmedabad"
            },
            {
                "place_id": "mz1zSK1YUrJTfvUrOA",
                "woeid": "90883450",
                "latitude": 23.027,
                "longitude": 72.57,
                "place_url": "/India/Gujarat",
                "place_type": "locality",
                "place_type_id": 7,
                "timezone": "Asia/Kolkata",
                "_content": "Ahmedabad, India",
                "woe_name": "Ahmedabad"
            }
        ],
        "query": "Ahmedabad, Gujarat, India",
        "total": 2
    },
    "stat": "ok"
}

but here problem is that this link return null i'm using following code of php

$json_array = file_get_contents("https://www.flickr.com/services/api/render?method=flickr.places.find&api_key=xxxxx&query=Ahmedabad,%20Gujarat,%20India&format=json&nojsoncallback=1");
$json_array = iconv('UTF-16', 'UTF-8', $json_array);
$json_data=json_decode($json_array,true);
print_r($json_data);


Your call is wrong. The correct one would be

https://api.flickr.com/services/rest/?method=flickr.places.find&.....