Fsockopen and proxy authentication in PHP -
i'm trying integrate proxy usage (with authentication) script queries whois data.
what i'm trying is
1) connect proxy ip , port 2) authenticate username , password 3) connect whois server , send domain details, receiving request in return.
i have script working without proxies
private function whois($domeinnaam, $whoisrule) { list ($server, $poort, $domein, $vrij) = $whoisrule; $domein = str_replace("{domein}", $domeinnaam, $domein); $fp = fsockopen($server, $poort); if($fp) { fputs($fp, $domein."\r\n"); $data = ""; while(!feof($fp)) { $data .= fread($fp, 1000); } fclose($fp); } else { $data = "error"; } // cache whois data $this->_whoisdata[$domein] = $data; return $data; }
but how integrate proxy server , authentication code?
curl has handy curlopt_proxy*
options. this answer shows how use them.
Comments
Post a Comment