I'm located behind a corporate firewall and can only access the web through a proxy. Is there anyway to get web pages off the net through PHP using a proxy?
Maybe a parameter to set?
Thanks!
Craig
I'm located behind a corporate firewall and can only access the web through a proxy. Is there anyway to get web pages off the net through PHP using a proxy?
Maybe a parameter to set?
Thanks!
Craig
Good question...I just ran into this problem also
Well, just wrote a function to do this. Modify for your needs. I did it to get the RSS feed from Slashdot...
<?
function damnProxy($page, $proxyHost, $proxyPort) {
$data = fsockopen($proxyHost, $proxyPort);
if(!$data) {
fclose($result);
echo "Cannot access ".$page;
}
else {
fputs($data,"GET $page HTTP/1.0\n\n");
while(!feof($data)) {
$cont=$cont.fread($data,4096);
}
}
fclose($data);
return substr($cont,strpos($cont,"\r\n\r\n")+4);
}
$slash = damnProxy("http://slashdot.org/slashdot.rdf", "proxy.yourcompany.com", 8080);
if($slash) {
echo $slash;
}
else {
echo "damned proxy";
}
?>