/ Published in: PHP
Sometimes you need a PHP script that will serve as a page proxy. Here it is!
Expand |
Embed | Plain Text
<?php $u = $_REQUEST["url"]; /* 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 ); */ ?>
You need to login to post a comment.
