I am trying to get the contents "name" of the nearest subway stations via the google maps api.
But i'm getting no results for some reason.
any ideas?
<?
$stations = file_get_contents('https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=XXXXX&location=51.517238,-0.0731695&rankby=distance&type=subway_station');
$stations = json_decode($stations);
foreach ($stations as $data)
{
echo $data->results->name;
}?>
**PRINT / VARDUMP OF $STATIONS **
object(stdClass)#113 (4) { ["html_attributions"]=> array(0) { } ["next_page_token"]=> string(468) "CrQCIQEAAIiUu7iBF_FuePInfUCwzG4ycBN9KTs3IQd0TF_VvYoz3ZHslqgGYANYyWPPcrtyLFjnHi6iBgbJqDTl972-fOLJsCJRhyKZsrXvx7I6RG9XBGFo4iVMqh10MVVjkCWSXKyW1M-vGneha2KLzQogqiGgYBLkG1dhyzlnaSmmpC0ur6rlzyTIRKQSewB79OjXi__cq7YuIcexmA3FqZHUqGtj2c8GL6X76wTeZWD37Rsl2WxC9FAsIqHQvxfOAySbf0xXtyWq6lxdBUt7rzbVRYfn5SrfQOapJGTe9Tx-ZculyJyMYEEC4pm4noVghQy0_LNgYCUxaiLjQv5_2DB4y5CPi8tDbLjAcHC7YOtAYEDYeIR7N5LAg2LDrXe378Z5zr0q8iLYmXqCFXoCJ9kwo4ISEFJHIBPTmrBDlEk9iCH8oEUaFBnA2CBg9vn9uYcNGZfFAQ50qyHk" ["results"]=> array(20) { [0]=> object(stdClass)#115 (11) { ["geometry"]=> object(stdClass)#116 (2) { ["location"]=> object(stdClass)#117 (2) { ["lat"]=> float(51.5151582) ["lng"]=> float(-0.0719412) } ["viewport"]=> object(stdClass)#118 (2) { ["northeast"]=> object(stdClass)#119 (2) { ["lat"]=> float(51.516427280292) ["lng"]=> float(-0.070816719708498) } ["southwest"]=> object(stdClass)#120 (2) { ["lat"]=> float(51.513729319709) ["lng"]=> float(-0.073514680291502) } } } ["icon"]=> string(73) "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png" ["id"]=> string(40) "47152d423eb61361555b2d8908e75c59d79deb1b" ["name"]=> string(12) "Aldgate East" ["photos"]=> array(1) { [0]=> object(stdClass)#121 (4) { ["height"]=> int(3966) ["html_attributions"]=> array(1) { [0]=> string(97) "Rene Lichtenstein" } ["photo_reference"]=> string(190) "CmRaAAAAPfCFksoZGq8FY3uKNCa271MIxH8dP7ZsE1lPnsvMep2OatQxY1SRN8LWxL4lRE_66vldeQbXnX7nrWg_bNLsGk9MYokXXq16ov1Hu01CSQe2nCqIQm6UzwcmjcqskSsDEhAIWrLuwREjELzxSkcPETQuGhSxU2Tai6pf8v4ugWTFDDz0amDAWA" ["width"]=> int(5950) } } ["place_id"]=> string(27) "ChIJ_7Q5M7UcdkgRCv-7nswC520" ["rating"]=> float(3.9) ["reference"]=> string(190) "CmRRAAAAqjpKiEO85qzXCVhdy9AhIyHZ2smVOnoDyGndzuW_s8G6yniXFcqGkdDTSA6xKZgLznbJUFbYRU3Kdth_wcx9aQXyvH7iua_zdt3PQ_Q-I3HstwRpW1nXDGXLFwcU6LVjEhD8CFwbm_VmLIpv820hobt3GhSQ9hZsbbGIoQ81bwfxTNHkMTKA6w" ["scope"]=> string(6) "GOOGLE" ["types"]=> array(4) { [0]=> string(14) "subway_station" [1]=> string(15) "transit_station" [2]=> string(17) "point_of_interest" [3]=> string(13) "establishment" } ["vicinity"]=> string(27) "Whitechapel High St, London" } [1]=> object(stdClass)#122 (11) { ["geometry"]=> object(stdClass)#123 (2) { ["location"]=> object(stdClass)#124 (2) { ["lat"]=> float(51.5142301) ["lng"]=> float(-0.0755928) } ["viewport"]=> object(stdClass)#125 (2) { ["northeast"]=> object(stdClass)#126 (2) { ["lat"]=> float(51.515579080292) ["lng"]=> float(-0.074243819708498) } ["southwest"]=> object(stdClass)#127 (2) { ["lat"]=> float(51.512881119709) ["lng"]=> float(-0.076941780291502) } } } ["icon"]=> string(73) "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png"