I have been all over the internet trying to find a solution to my specific problem but no luck.
Basically I have a URL that I log into that looks similar to this: https://some-website.university.edu.au:8781/elements/v4.9/users/
Which will return to the browsers an XML block of text with all of the users.
I am looking to use curl or SimpleXMLElement() or whatever it takes to bring that XML into my php variable and output it.
The closest I feel I have got is:
$username = 'usernameX';
$password = 'passwordX';
$URL = 'https://some-website.university.edu.au:8781/elements/v4.9/users/';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $username.":".$password);
$result=curl_exec ($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code
echo $result;
or
$url = 'https://usernameX:passwordX@some-website.university.edu.au:8781/elements/v4.9/users/';
echo $url."<br />";
$xml = new SimpleXMLElement($url);
print_r($xml);
I'm not sure if either is close or whether curl is better than SimpleXMLElement() or if one or both just will never work.
I have added a screenshots to show the what is returned on the website. The login screen is just the browser default one. Any help would be amazing. Thanks!