Couldn't get " . $type . " for that location"; print "back"; print "

" . $url; die(); } $json = ""; while(!feof($handle)) { //read file line by line into variable $json = $json . fgets($handle, 4096); } fclose ($handle); $jsonArray = json_decode($json, true); $startLatLon = $jsonArray['query_latlong']; list($startLat,$startLon) = split(" ", $startLatLon); $arrayJavascript=""; foreach ($jsonArray[$type] as $item) { if ($type=="hospitals") { $itemType = "hospital"; if ($item['hasaande']=="true") $itemType = "hospital_hasaande"; $arrayJavascript .= "["; $arrayJavascript .= $item['longitude'] . ", "; $arrayJavascript .= $item['latitude'] . ", "; $arrayJavascript .= "\"" . $item['name'] . "\", "; $arrayJavascript .= "\"" . $item['url'] . "\","; $arrayJavascript .= "\"" . $itemType . "\""; $arrayJavascript .= "],\n"; } elseif ($type=="registries") { $arrayJavascript .= "["; $arrayJavascript .= $item['longlat'][0] . ", "; $arrayJavascript .= $item['longlat'][1] . ", "; $arrayJavascript .= "\"" . $item['name'] . "\", "; $arrayJavascript .= "\"" . $item['url'] . "\","; $arrayJavascript .= "\"registry_office\""; $arrayJavascript .= "],\n"; } } $arrayJavascript = substr($arrayJavascript, 0, -2); //drop last charS (comma newline) //print "
$arrayJavascript
"; ?>