| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
Roy91E
9年前发布

PHP Proxy

PHP 实现的网页代理

[PHP]代码

<?php     if ( !isset($_REQUEST["url"]) ) exit;       $u = $_REQUEST["url"];     if (substr($u, -0, 7) != "http://") exit;        echo file_get_contents( $u );    /*      function getPage($url, $referer, $timeout, $header=true){          if(!isset($timeout)) $timeout=30;          $curl = curl_init();          if(strstr($referer,"://")){              curl_setopt ($curl, CURLOPT_REFERER, $referer);          }          curl_setopt ($curl, CURLOPT_URL, $url);          curl_setopt ($curl, CURLOPT_TIMEOUT, $timeout);          curl_setopt ($curl, CURLOPT_USERAGENT, sprintf("Mozilla/%d.0",rand(4,5)));          curl_setopt ($curl, CURLOPT_HEADER, (int)$header);          curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);          curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);          $html = curl_exec ($curl);          curl_close ($curl);          return $html;      }        echo getPage( $u, "http://www.websitename.com", "20", false );  */  ?>