示例#1
0
    $radius = $_POST['radius'];
}
$api_key = "";
if (!empty($_POST['api_key'])) {
    $api_key = $_POST['api_key'];
}
$category_ids = "";
if (!empty($_POST['category_ids'])) {
    $category_ids = $_POST['category_ids'];
}
$keywords = "";
if (!empty($_POST['keywords'])) {
    $keywords = $_POST['keywords'];
}
if (Constants::API_KEY == $api_key) {
    $results = $controllerRest->getResultSearchDeals($radius, $lat, $lon, $keywords, $category_ids);
    $no_of_rows = $results->rowCount();
    $arrayJSON = array();
    $arrayJSON['result_count'] = "" . $no_of_rows . "";
    $ind = 0;
    $arrayObs = array();
    foreach ($results as $row) {
        $arrayObj = array();
        foreach ($row as $columnName => $field) {
            if (!is_numeric($columnName)) {
                $val = trim(strip_tags($field));
                $val = preg_replace('~[\\r\\n]+~', '', $val);
                $val = htmlspecialchars(trim(strip_tags($val)));
                $arrayObj[$columnName] = "" . $val . "";
            }
        }