views:

12

answers:

1

Hello All,

How can I access a xml feed with HAUTH in PHP?

Dummy link format is http://username:[email protected]/www.domain.com/trends/001.xml

I'm using the code below to access it.

$doc = new DOMDocument();
$doc->load($source);

Thanks in advance, steamboy

A: 

You might try to use curl to get the content of the password protected file. Here is a class that enables you to easily get that data: http://de.php.net/manual/en/book.curl.php#90821

You need to set the CURLOPT_USERPWD option in curl for the password protection.

Kau-Boy