function get_dyn_pois($fw_dynamic)
{
    $conf_data = file_get_contents("poi_dp_dyn_conf.json");
    $conf = json_decode($conf_data, true);
    $sources = $fw_dynamic["sources"];
    $dyn_data = array();
    $n_sources = count($sources);
    for ($i = 0; $i < $n_sources; $i++) {
        $source = $sources[$i];
        $host = $source["host_type"];
        $type = $source["data_type"];
        if (array_key_exists('host_id', $source)) {
            $ids = $source["host_id"];
            $id = $source["host_id"][0];
        } else {
            $ids = array();
            $id = '';
        }
        switch ($conf["host_type"][$host]["method"]) {
            case "REST_GET":
                $url = $conf["host_type"][$host]["params"]["url"] . $id . $conf["host_type"][$host]["params"]["params"];
                $options = array('headers' => $conf["host_type"][$host]["params"]["headers"]);
                $output = http_get($url, $options);
                break;
            case "REST_POST":
                $i = 0;
                $data = $conf["host_type"][$host]["params"]["params"];
                foreach ($ids as $id) {
                    $data = str_replace('$' . $i++, $id, $data);
                }
                if (is_array($data)) {
                    $data = json_encode($data);
                }
                $output = http_post_data($conf["host_type"][$host]["params"]["url"], $data, array('headers' => $conf["host_type"][$host]["params"]["headers"]));
                break;
        }
        $data = http_parse_message($output)->body;
        // merge separate sources
        $mapped_data = map_data($conf["data_mapping"][$type], $data);
        $dyn_data = array_merge_r2($dyn_data, $mapped_data);
    }
    return $dyn_data;
}
function &array_merge_r2(array &$array1, &$array2 = null)
{
    $merged = $array1;
    if (is_array($array2)) {
        foreach ($array2 as $key => $val) {
            if (is_array($val)) {
                $item = isset($merged[$key]) && is_array($merged[$key]) ? array_merge_r2($merged[$key], $val) : $val;
            } else {
                $item = $val;
            }
            if (is_int($key)) {
                array_push($merged, $item);
            } else {
                $merged[$key] = $item;
            }
        }
    }
    return $merged;
}