All pastes #616593 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-12 18:46 UTC
rendered paste body
<?php
class Curl
{            
    function setup()
    {
        $cookieJar = 'cookies.txt';
        curl_setopt($this->curl, CURLOPT_COOKIEJAR, $cookieJar); 
        curl_setopt($this->curl, CURLOPT_COOKIEFILE, $cookieJar);
        curl_setopt($this->curl, CURLOPT_AUTOREFERER, true);
        curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
        curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
        
        curl_setopt($this->curl, CURLOPT_HEADER, 1);
        curl_setopt($this->curl, CURLOPT_HTTPPROXYTUNNEL, 1);
        curl_setopt($this->curl, CURLOPT_PROXY, '88.208.220.186:8080');     
    }
    
    function clean($contents)
    {
        return $contents = str_replace('<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAA6ElvpTmZs4PUpZpSAoK6BSHXJsp5oogWH5jZodYSc2VMsh-GBSvecccQD_seEoYLmo-SsWfitQQEw" type="text/javascript"></script>', '', $contents);
    }
    
    function get($url)
    { 
        $this->curl = curl_init($url);
        $this->setup();
        
        return $this->clean($this->request());
    }
    
    function getAll($reg,$str)
    {
        preg_match_all($reg,$str,$matches);
        return $matches[1];
    }
    
    function postForm($url, $fields, $referer='')
    {
        $this->curl = curl_init($url);
        $this->setup();
        curl_setopt($this->curl, CURLOPT_URL, $url);
        curl_setopt($this->curl, CURLOPT_POST, 1);
        curl_setopt($this->curl, CURLOPT_REFERER, $referer);
        curl_setopt($this->curl, CURLOPT_POSTFIELDS, $fields);
        return $this->request();
    }
    
    function getInfo($info)
    {
        $info = ($info == 'lasturl') ? curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL) : curl_getinfo($this->curl, $info);
        return $info;
    }
    
    function request()
    {
        return curl_exec($this->curl);
    }
}
$curl = new Curl;

echo $curl->get('http://whatismyip.com/');

/*$ch = curl_init('http://www.whatismyip.com');
//curl_setopt($ch, CURLOPT_URL, 'http://www.whatismyip.com');
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, '88.208.220.186:8080');
echo $data = curl_exec($ch);
curl_close($ch);*/

?>