Rapid Share Link Checker
I made another program under my friend’s request for it. It’s a RapidShare.com link checker. It checks if links are dead or not then adds up the filesizes. It’s a very simple PHP script. It basically works by opening each HTML document, searching for the string with the memory, storing them into an array, then adding them up. If a filesize is not found, it classified the link as DEAD. It’s a very simple and could use more security like checking if the link is a rapidshare link before opening it and so forth.
Source Code:
<?php
$links = $_POST['links']; // get links from POST
$links = explode(”\n”,$_POST['links']); // explode links
$z = 0;
$filesize = array(); // define array
while($z <= count($links) -1){ // while $z is smaller than the number of links
$html = $links[$z]; // store link into var
$html = @file_get_contents($html); // get contents of link
preg_match(”/\(<b>(.*)<\/b> KB\)/i”,$html,$matches); // pregmatch to get the filesize
$filesize[$z] = $matches[1]; // store filesize in array
if(!$filesize[$z]){ // if filesize doesn’t exist
$filesize[$z] = 0; // define as zero
$links[$z] = $links[$z].” DEAD”; // define as DEAD
}
$z++;
}
$filesize[total] = array_sum($filesize); // add all filesized
$filesize[unit] = “KB”; // default unit is KB
if($filesize[total] >= 1024){ // If is more than 1024 KB
$filesize[total] /= 1024; // divide value with 1024
$filesize[unit] = “MB”; // define as MB
if($filesize[total] >= 1024){ // if value it bigger than 1024 again
$filesize[total] /= 1024; // divide by 1024 again
$filesize[unit] = “GB”; // and define as GB
}
}
?>
…
<?php
$i = 0;
while($i <= count($links) -1){ // while $i is smaller than the number of links
echo $links[$i].” (<b>”.$filesize[$i].”</b>)<br />”; // print them
$i++;
}
echo “<b>Total</b>: “.round($filesize[total],2).$filesize[unit]; // print total filesize
?>







i have test the source code but she give me always error can you tell meplease whats wrong
Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in C:\wamp\www\links\includes\config.php on line 9
Parse error: syntax error, unexpected T_STRING in C:\wamp\www\links\includes\config.php on line 9
on this line
preg_match(’/\((.*) KB\)/i’,$html,$matches);
thanks
I just copies the code onto a test page and it didn’t cause an error. It might be a difference in PHP versions. I ran mine on a Linux hosting service.
Otherwise, I believe you may have used the fancy quotation marks. Try retyping the whole thing using the normal quotation marks.
i use wampserver 2 on windows xp
apache 2.2.8
php 5.2.6
and i did replaced the quotation marks with normal quotation marks
what i did i make it a copy of your home page of link checker and name it index.php and i rename your codesource to config.php
and i add include the config.php
thats all what i did