I’m trying to use simplexml to load an xml file from a server:
$xml = simplexml_load_file($xml_query);
The server needs HTTP authentication, so (unsurprisingly) I get an error message:
HTTP request failed! HTTP/1.1 401
Unauthorized
Is it possible to pass my username and password to the server using this function?
EDIT
If anyone can tell me a more secure way to do this, I’d be grateful.
You should be able to prepend the username and password to the URL you’re opening. Instead of
try