2011年4月23日土曜日

Proxy and Php

This program can be used to access a page via a proxy server. 
<?php
$opts = array('http' => array('proxy' => 'tcp://60.28.212.62:80', 'request_fulluri' => true));
$context = stream_context_create($opts);
while(1){
 $s = file_get_contents('http://www.google.com', false, $context);
 echo $s;
        //stop for 10 seconds.
 sleep(10);
}
?>