Home php get_headers on hosting shows false

get_headers on hosting shows false

Author

Date

Category

When the script is executed on the OPEN SERVER on my computer, the response is "HTTP / 1.1 403 Forbidden" and this is the correct response.
When executed on a virtual server on the hosting SPRINTHOST.ru the response is "HTTP / 1.1 200 OK" is a lie!
What’s the matter, why the hosting forces the script to execute differently.

$ headers = @get_headers ('https://user11183.clients-cdnnow.ru/hls/TV1000_HD/master .m3u8 ');
  echo $ headers [0];

Answer 1

response from local server

array (11) {[0] = & gt; string (22) "HTTP / 1.1 403 Forbidden" [1] = & gt; string (13) "Server: nginx" [2] = & gt; string (35) "Date: Fri, 03 Apr 2020 18:32:31 GMT" [3] = & gt; string (23) "Content-Type: text / html" [4] = & gt; string (19) "Content-Length: 146" [5] = & gt; string (17) "Connection: close" [6] = & gt; string (25) "X-Geo-Allowed-Country: no" [7] = & gt; string (22) "X-Geo-Country: Belarus" [8] = & gt; string (14) "X-Geo-Code: BY" [9] = & gt; string (21) "X-Geo-City: Dokshytsy" [10] = & gt; string (23) "X-Edge-Ip: 172.19.25.48"}

response from hosting

array (15) {[0] = & gt; string (15) "HTTP / 1.1 200 OK" [1] = & gt; string (13) "Server: nginx" [2] = & gt; string (35) "Date: Fri, 03 Apr 2020 18:32:20 GMT" [3] = & gt; string (43) "Content-Type: application / vnd.apple.mpegurl" [4] = & gt; string (17) "Connection: close" [5] = & gt; string (44) "Last-Modified: Fri, 03 Apr 2020 18:32:20 GMT" [6] = & gt; string (20) "ETag:" 5e878134-1ff "" [7] = & gt; string (13) "X-Coder: mb-1" [8] = & gt; string (30) "Access-Control-Allow-Origin: *" [9] = & gt; string (42) "Cache-Control: no-cache, no-store, private" [10] = & gt; string (26) "X-Geo-Allowed-Country: yes" [11] = & gt; string (21) "X-Geo-Country: Russia" [12] = & gt; string (14) "X-Geo-Code: RU" [13] = & gt; string (18) "X-Edge-Cache: MISS" [14] = & gt; string (23) "X-Edge-Ip: 172.19.25.12"}

in one answer X-Geo-Allowed-Country: yes and in another X-Geo-Allowed-Country: no
This is how I understand the redirection depending on the region, from here and the error.


Answer 2

403 Forbidden – access to the file is denied.

HTTP / 1.1 200 OK – file found, access is open.

See access rights

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions