Search code examples
phpsimplexmlhttp-authentication

php simplexml_load_file() with password protected url


Simple question for the one who knows the answer...

$xml = simplexml_load_file("http://url/path/file.xml");

This url is .htaccess protected, how can I pass the login/password as arguments to the function?


Solution

  • $xml = simplexml_load_file("http://username:password@url/path/file.xml");
    

    Try that :)