I'm checking to see if certain mp3's exist. While sometimes there's no problem, certain valid mp3 files are shown as 404, not found. Here's the code I'm using:
$ch = @curl_init($file_path);
@curl_setopt($ch, CURLOPT_HEADER, true);
@curl_setopt($ch, CURLOPT_NOBODY, true);
@curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
@curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
@curl_exec($ch);
$header = curl_getinfo($ch);
curl_close($ch);
echo "<pre>";
print_r($header);
echo "<pre>";
I thought that the problem was because the sites were using redirects, but setting "CURLOPT_FOLLOWLOCATION" to TRUE didn't solve the problem.
The http code shows 404 on the following mp3s. You can go to them in your browser and see that they work. These are just a few random examples of many that have this problem:
http://www.dagatinha.com.br/musicas/Lady%20Gaga%20%20-%20Just%20Dance.mp3
All help is appreciated!