jurass1c Posted March 28, 2010 Share Posted March 28, 2010 Hey guys I am working on a script that checks rapidshare links. What i have got so far is a form that will check links submitted into the form. What i am trying to do is instead of the links/link being checked on "submit" ( if(isset($_REQUEST['submit'])) ) i want to get each link from the database to be checked without having to enter the links into the form. If you goto http://www.whiteshabu.com/WhiteShabu/v2.php you will see the script in action. You will notice that links automatically appear above the form. If you where to copy and paste those links into the form and hit submit it will check if they are valid or not. How would i get this check to happen as soon as those links load up without having to copy and paste into the form. I use this link of code to connect and echo my links: <? $con = mysql_connect("localhost","dbuser","dbpass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("dbselect", $con); $result = mysql_query("SELECT * FROM table"); while($row = mysql_fetch_array($result)) { echo $row['link']; echo "<br />"; } mysql_close($con); ?> Here is my HTML form that you enter the links into: <form method="post" action=""> Rapidshare Links:<br /> <textarea name="url" rows="10" cols="50"> </textarea><br /><br /><input type="submit" name="submit" value="Check Links"> | <input type="reset" value="Clear"> </form> this is the PHP that does the check: <?php if(isset($_REQUEST['submit'])){ echo "<br />-------------------------------------------------<br />"; $url = @$_POST['url']; if ($url == ""){ echo "Invalid URL(s)"; } else { $url = explode(" ", $url); $url = implode("\n", $url); $url = explode("\n", $url); $url = array_unique($url); foreach ($url as $urls){ $rsurls = @file_get_contents($urls); if (preg_match("/FILE DOWNLOAD/", $rsurls)){ echo '<a href="'.$urls.'"><font color="green">'.$urls.'</font></a> - Valid<br />'; } else { echo '<a href="'.$urls.'"><font color="red">'.$urls.'</font></a> - Dead<br />'; } } echo "<br /><font size=\"2\">".sizeof($url)." Links Checked</font>"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/196751-link-checking-help/ Share on other sites More sharing options...
dreamwest Posted March 28, 2010 Share Posted March 28, 2010 $content = file_get_contents('rapid url'); $find=explode('The file could not be found', $content); if ($find[1] != ""){ echo "Ghost!<br>"; echo "FILE NOT FOUND!!...Deleting <br>"; }else{ //continue } Quote Link to comment https://forums.phpfreaks.com/topic/196751-link-checking-help/#findComment-1032912 Share on other sites More sharing options...
jurass1c Posted April 14, 2010 Author Share Posted April 14, 2010 Hey. Thanks for helping me on this one. My rapidshare link checker works fine and i also managed to get it working with hotfile but recently went to use it, it failed to work. any help would be greatly appreciated. here's my script: <? $result = mysql_query("SELECT * FROM database WHERE provider='HotFile.com'") or die('cant select'); $cnt = 1; while($row = mysql_fetch_array($result)) { $url = $row['link']; $rsurls = @file_get_contents($url); if (preg_match("/REGULAR DOWNLOAD/", $rsurls)){ echo '<a href="'.$url.'"><font color="green">'.$url.'</font></a> - Valid<br />'; }else{ echo '<a href="'.$url.'"><font color="red">'.$url.'</font></a> - Dead - <a href="delete.php?id=' .$row['id']. '">Delete</a><br />'; }//end preg match ++$cnt; }//end while loop echo "<br /><font size='2'>{$cnt} Links Checked</font>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/196751-link-checking-help/#findComment-1041867 Share on other sites More sharing options...
jurass1c Posted April 15, 2010 Author Share Posted April 15, 2010 has anyone got any idea's here ? is it possible that it's the issue with the server it's checking ? Quote Link to comment https://forums.phpfreaks.com/topic/196751-link-checking-help/#findComment-1042353 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.