If I call an URL directly on browser, i will get response, but when I try to get contents from this URL using file_get_contents
or CURL
it returns nothing, get empty page (here am using url start with local ip address .eg :http://192.168.x.xxx/device/reader-config?action=get
).
Is there any connection with local ip?
here is my code,
$url = 'http://192.168.x.xxx/device/reader-config?action=get';
$username = 'username';
$password = 'password';
$context = stream_context_create(array('http' =>
array('header' => "Authorization: Basic " . base64_encode("$username:$password"))
));
$rawdata = file_get_contents($url, false, $context);
print_r($rawdata);