I have this script:
$server = "https://server.com"; $fileType = "/api/table.json?"; $uName = "bart"; $pWord = "XXXXXX"; $url = "content=devices&id=2672&output=xml&columns=group,name&username=" . $uName . "&userhash=" . $pWord; $request = $server . $fileType . $url; echo file_get_contents($request);
when i call it via php -f file.php I get this error:
failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized
if i load the url into browser, it works as expected. any thoughts?
Add comment