der("Content-Type: text/html; charset=utf-8"); $httpHost=$_SERVER['HTTP_HOST']; #$httpHost="http://10.252.26.112:4503"; $requestUri=$_SERVER['REQUEST_URI']; $regex = "(\w\w-\w\w)"; //$inputString = "/asdadadsdads"; $redirecturl=""; $user_agent = $_SERVER["HTTP_USER_AGENT"]; if (empty($user_agent)) { $user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1"; } function get_url($url) { $ch = curl_init(); if($ch === false) { die('Failed to create curl object'); } $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); #curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); #curl_setopt($ch, CURLOPT_CUSTOMREQUEST,'GET'); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt($ch, CURLOPT_ENCODING ,""); $data = curl_exec($ch); curl_close($ch); return $data; } //preg_match_all($regex, $inputString, $output); if (preg_match_all($regex, $requestUri, $output)) { #echo $output[0][0]."
".$output[0][1]."\n"; $locale=$output[0][0]; } else { $locale=""; } if (!empty($locale)) { $redirecturl="/".$locale."/404"; } else { $redirecturl="/404"; } echo get_url("https://".$httpHost.$redirectur); #echo urldecode("https://".$httpHost.$redirecturl); ?>