Php Proxy lire une page

➜Php Proxy lire une page

#1 Wednesday 27th June 2007 14:07:13 Week 26

Guest
Guest

Php Proxy lire une page

Pour lire une page via un proxy ( exemple : Privoxy )


function Proxy($url) {
    $proxy_server = "localhost";
    $proxy_port = 8118;
    if (substr($url, 0,7) <> 'http://')return false;
    $proxycon = fsockopen($proxy_server, $proxy_port, $errno, $errstr);
    fputs($proxycon,"GET ".$url." HTTP/1.0 rnrn");
    //fputs($proxy_fp, "Proxy-Authorization: Basic ". base64_encode ("$proxy_user:$proxy_pass")."rnrn");
    $reading_headers = true;
    while (!feof ($proxycon)) {
        $curline = fgets($proxycon, 4096);
        if ($curline=="rn")$reading_headers = false;
        if (!$reading_headers)$filecontent .= $curline;
    }
    fclose($proxycon);
    return $filecontent;
}

 

Board footer

Blog, Sitemap, Projets, Videos XXX Allopass, Rachat de Credit
Php Proxy lire une page © BMX - - 03:28:00@11 -