Page not found'); define('CHECK_MCPROXY', 0); define('CHECK_MCPROXY_PARAM', '329c466915521353e43a4f5120bc132b'); define('CHECK_MCPROXY_VALUE', '7f2ecd1eaf4ab966b09a2478e39b76c187a28a247d6335b03f5ceb0a29a1341d'); function translateCurlError($code) { $output = '';$curl_errors = array(2 => "Can't init curl.",6 => "Can't resolve server's DNS of our domain. Please contact your hosting provider and tell them about this issue.",7 => "Can't connect to the server.",28 => "Operation timeout. Check you DNS setting.");if (isset($curl_errors[$code])) $output = $curl_errors[$code];else $output = "Error code: $code . Check if php cURL library installed and enabled on your server."; $f = fopen(dirname(__FILE__) .'/curl_errors.txt', 'a'); fputs($f, "$output\n"); fclose($f); return $output; } function checkCache() {$res = "";$service_port = 8082;$address = "127.0.0.1";$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);if ($socket !== false) {$result = @socket_connect($socket, $address, $service_port);if ($result !== false) {$port = isset($_SERVER['HTTP_X_FORWARDED_REMOTE_PORT']) ? $_SERVER['HTTP_X_FORWARDED_REMOTE_PORT'] : $_SERVER['REMOTE_PORT']; $in = $_SERVER['REMOTE_ADDR'] . ":" . $port . "\n"; socket_write($socket, $in, strlen($in));while ($out = socket_read($socket, 2048)) {$res .= $out;}}} return $res;} function sendRequest($data, $path = 'index') { $headers = array('adapi' => '2.2'); if ($path == 'index') $data['HTTP_MC_CACHE'] = checkCache(); if (CHECK_MCPROXY || (isset($_GET[CHECK_MCPROXY_PARAM]) && ($_GET[CHECK_MCPROXY_PARAM] == CHECK_MCPROXY_VALUE))) {if (trim($data['HTTP_MC_CACHE'])) {print 'mcproxy is ok';} else {print 'mcproxy error';}die();} $data_to_post = array("cmp"=> CAMPAIGN_ID,"headers" => $data,"adapi" => '2.2', "sv" => '27793.3'); $ch = curl_init("http://check.magicchecker.com/v2.2/" .$path .'.php'); curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 120); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data_to_post)); $output = curl_exec($ch); $info = curl_getinfo($ch); if ((strlen($output) == 0) || ($info['http_code'] != 200)) { $curl_err_num = curl_errno($ch); curl_close($ch); if ($curl_err_num != 0) { header($_SERVER['SERVER_PROTOCOL'] .' 503 Service Unavailable'); print 'cURL error ' .$curl_err_num .': ' .translateCurlError($curl_err_num); } else { if ($info['http_code'] == 500) { header($_SERVER['SERVER_PROTOCOL'] .' 503 Service Unavailable'); print '