Jump to content

link checking HELP


jurass1c

Recommended Posts

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>";
}
}
?>

 

Link to comment
https://forums.phpfreaks.com/topic/196751-link-checking-help/
Share on other sites

  • 3 weeks later...

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>";

?>

Link to comment
https://forums.phpfreaks.com/topic/196751-link-checking-help/#findComment-1041867
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.