I have a php file that takes JSON data coming from a url. I want some keys and values to be included in my local database and remaining keys and values to be uploaded in the database of OpenStreetMap (OSM).
I want to call the respective php file with the GET parameters from the main php file.
My script looks like this:
<?php
$url = "something";
$parts = file_get_contents($url);
$json = json_decode($parts);
//echo(sizeof($json));
$private = array("people_count");
$to_osm = array("Rent","drinking_water","Shop","communication","Energy_source","waste_management","Internet_access","emigrants","number_storey","adboard");
foreach ($json as $object) {
$get_url = "?id=";
foreach ($object as $key => $value) {
if ($key == "osmid") {
$id = $value;
$geom = "Polygon";
$get_url.=$id."&geom=".$geom;
//print_r($get_url);
}
elseif (in_array($key, $to_osm)) {
$get_url.="&".$key."=".$value;
}
}
print_r("updateOSM.php".$get_url);
}
?>
I tried include but that didn't worked. I cannot redirect my page as I am running loop.
Any help would be appreciated.