PATH://adammoro.net/code/php/

PHP Function: cURL Proxy Browse

A very basic implementation of cURL/PHP that tunnels a URL request through an HTTP proxy. This function can easily be used with a simple form (example form displayed just below the script) for creating a very basic proxy browser.

            <?php function curl_proxy_browse($url) {

            $url = "http://adammoro.net/code/php/";
            $proxy = "INSERT-PROXY-HERE";
            
            $ch = curl_init();
            
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_PROXY, $proxy);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            
            $data = curl_exec($ch); 
            curl_close($ch); 
            return $data; 
            }
            
            $page = curl_proxy_browse($url);
            echo $page;
            ?>