I want to check if some file on some other server exists. I have this code (but something is wrong with it):

foreach($files as $file){
$xml=new SimpleXMLElement($file,null,true);
foreach($xml as $info){
$notworking[$false]=$info->name." => ".$info->author;
echo "(some songs don't exist: <a href=\"javascript:void(0)\" onclick=\"window.open('notexist.php','popupWindow','height=500,width=600,left=30,top=40,toolbar=no,location=no,status=no,menubar=no,scrollbars=no');\">$false</a>)";
echo "(everything's OK)";

I'm getting "(everything's OK)", but one file isn't OK (it doesn't exist). Is there some error in code or what? Thanks a lot! (PS. And with XML file is everything OK)

Maybe, because you do not close the open file in the first loop.

No, it's not that. But when I open this file, it automatically redirects me to home page. Is this problem because of redirection, or?

Possible. I think fopen follows redirects. IIRC there may be a way to set maximum number of redirects to follow. You'd have to google for it.

I found something, but it doesn't work.

$redirect=array('http'=>array('max_redirects'=>'0')); //I tried to add only 0
echo "false";
else echo "true";

I'm getting true. What's mistake?

According to this page, max_redirects should be set to 1. Apparantly it denotes requests, not redirects.

Mistake is in ==, it must be ===. So:

echo "true";
else echo "false";

Thanks a lot for helping me!
There's still a mistake. For existing files it also returns false (eg. http://uploads.mp3songurls.com/1102493.mp3)

eff you for trying to steal my files asswipe