PHP Proxy
2018-07-20 来源:open-open
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 ); */ ?>
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐