Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 649

Failing to load a JSON File on my server HTTP 401

$
0
0

first of all, my script:

<?php$str = file_get_contents('https://externurl');$json = json_decode($str, true); // echo '<pre>' . print_r($json, true) . '</pre>';?>

I am not allowed to share the link but it is a JSON file, which is ip protected.The Host of the JSON file whitelisted the IP of my domain.When I execute the file on my server, I get an empty page. In the error logs I find this:

[10-Jun-2018 18:12:48 America/New_York] PHP Warning:  file_get_contents(https://url): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in /home/be/public_html/testtest/testing3.php on line 2

Then I checked with a not protected json file and I don't get this error. The IP is 100% whitelisted and is the IP of my domain.

Does it have something to do that I am on shared hosting? I am trying to solve this now for all day and read something about sending header because of the shared hosting, but I have no idea how. Am I on the right track?


Viewing all articles
Browse latest Browse all 649

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>