1

I'm trying to get the headers from several URL with get_headers().

It's working correctly for some URL but for others I receive HTTP/1.1 404 File Not Found as an answer but when I analyze it with a tool such as http://web-sniffer.net/ i see that the real answer is HTTP/1.0 302 Found.

When i'm trying with a browser, I'm redirected to another URL so the good answer should not be the 404 one...

What do I need to change in order to receive the correct header in my script?

For example this URL: http://mp3lg4.tdf-cdn.com/10160/rmc.mp3

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
bernardo
  • 381
  • 3
  • 9
  • 1
    They might be blocking cURL calls. Without the URL, it's difficult to know. – ceejayoz Jan 12 '15 at 22:30
  • I added an example of URL. Are you sure get_headers is a function of cURL ? – bernardo Jan 12 '15 at 22:36
  • Is this example URL returns a 404 for you? – barell Jan 12 '15 at 22:37
  • No, `get_headers` doesn't use cURL, but they may have mechanisms to block what appear to be bots using cURL and cURL-like calls. I'm able to do `get_headers` successfully against that URL locally, so it's possible your particular server has been blocked. I'd guess they don't want you downloading their MP3s? – ceejayoz Jan 12 '15 at 22:39
  • Ok i fixed it. I was trying to get the header inside a loop. I tried out of the loop and it works perfectly. So i put a timer between each request and it works... o_O strange... It's a public radio stream, I just wanted to know the status of it so I can update my playlist :) Thanks guys ! – bernardo Jan 12 '15 at 22:52

0 Answers0