public static function ajax_get_url_status() { if (isset($_REQUEST['url']) && isset($_REQUEST['country'])) { header("Content-Type: application/json"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Expires: 0"); $lookup = Amber::get_availability(); $lookup_result = $lookup->get_status($_REQUEST['url'], $_REQUEST['country']); if ($lookup_result === FALSE || !isset($lookup_result['data'])) { status_header(500); die; } foreach ($lookup_result['data'] as $key => $value) { $lookup_result['data'][$key]['behavior'] = Amber::get_behavior($lookup_result['data'][$key]['available']); } print json_encode($lookup_result, JSON_UNESCAPED_SLASHES); status_header(200); } else { status_header(400); } die; }