1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[GET]PHP Script, Using Proxy To Request a URL

Discussion in 'Black Hat SEO Tools' started by IPXPRT, Jan 17, 2011.

  1. IPXPRT

    IPXPRT Jr. VIP Jr. VIP

    Joined:
    Oct 25, 2010
    Messages:
    3,632
    Likes Received:
    1,230
    Home Page:
    Here is How to use a proxy to request a URL in PHP...

    function getUrlContents($url, $timeout = 30, $proxy = NULL) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    if ($proxy != NULL) {
    curl_setopt($curl, CURLOPT_PROXY, $proxy);
    }
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
    curl_setopt($curl, CURLOPT_MAXREDIRS, 5);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, FALSE);
    $contents = curl_exec($curl);
    curl_close($curl);
    return $contents;
    }
    Example:
    getUrlContents("http://www.google.com", 30, '111.111.111.111:3128')

    where 111.111.111.111:3128 is proxy


    EnJoy!!! :):):)