PHP => ISA Authentication

Hi,

I’m looking to get some advice/help on some code i’m trying to implement. I have recently setup a WAMP server at work and would like to create a basic rss reader. To do this i would like to download a copy of the BBC’s XML file daily. I have tried this at home and all I had to do was:
[php]
echo copy(“http://feeds.bbci.co.uk/news/world/rss.xml","BBC.xml”);
[/php]
At work however we have an ISA server so this code throws up and error. I have modified it to:
[php]

<?php $details = array( 'http' => array( 'proxy' => 'tcp://10.0.0.3:8080', 'request_fulluri' => true, 'header' => "Proxy-Authorization: Basic " . base64_encode("'domain\username:password'"), ), ); $details2 = stream_context_create($details); echo copy("http://feeds.bbci.co.uk/news/world/rss.xml","BBC.xml",$details2); ?>

[/php]

However i’m still getting the error:
Warning: file_get_contents(http://feeds.bbci.co.uk/news/rss.xml): failed to open stream: HTTP request failed! HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web P in C:\wamp\www\XmlTest.php on line 13

Any help would be much appreciated!!!

I do not think that stream contexts can handle proxy authentication. You might be better off looking into how to use curl, which is faster and has the benefit of allowing you to use a native form of proxy authentication through the curl_setopt parameter instead of relying on handmade methods.

A request code 407 means that the headers were not there. So ISA did not understand your proxy-authorization header.

Sponsor our Newsletter | Privacy Policy | Terms of Service