Hi!
I want to check if some file on some other server exists. I have this code (but something is wrong with it):
<?php
$notworking=array();
$false=0;
$link="http://uploads.mp3songurls.com/";
$files=glob("genre/*.xml");
foreach($files as $file){
$xml=new SimpleXMLElement($file,null,true);
foreach($xml as $info){
if(fopen($link.$info->link.".mp3","r")==false){
$false++;
$notworking[$false]=$info->name." => ".$info->author;
}
}
}
if($false>0){
$file=fopen("notworking.txt","w");
for($i=1;$i<=$false;$i++){
fwrite($file,$notworking[$i]."\r\n");
}
fclose($file);
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>)";
}else{
if(file_exists("notworking.txt"))
unlink("notworking.txt");
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)