Jump to content

masky666

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

masky666's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi. I have text files in the directory that contain rapidshare.com links. Now what I need to do is take them one by one and check links inside them one by one using rapidshare API. Everything works fine apart from one thing. It reads files and deletes the ones containing dead links but the problem is that it only deletes the file if ALL links are dead, but not when only one link is dead or some of them. Code: <?php function rs_check($url){ if (!$url) return false; $files_pattern= '/\/files\/([^\/]*)\//'; $filename_pattern= '/\/files\/.*\/(.*)/'; preg_match($files_pattern, $url, $matches_id); preg_match($filename_pattern, $url, $matches_name); $res= file_get_contents("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=checkfiles_v1&files={$matches_id[1]}&filenames={$matches_name[1]}"); list($fId,$fName,$fSize,$fServerId,$fStatus,$fShortHost,$fmd5) =explode(',',$res); return ($fStatus==1 || $fStatus==2); } $directory = "download/"; $linksfiles = glob("" . $directory . "*.txt"); foreach($linksfiles as $linkfile) { $lf = file_get_contents($linkfile); $purefilename = str_replace($directory, "" , $linkfile); if($purefilename != "5100c00fdb545e12e8cb4f9c5f69ec21.txt"){ if(rs_check($lf) != 1){ unlink($directory . $purefilename); echo("<br />"); } } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.