This is my first script so go easy on me. It's a bit dirty, but gets the job done. I started learning php about two weeks ago.
The problem: I have a trackback spammer that outputs a file of "successful" trackbacks spammed. It looks something like this:
Note: Those are wordpress blogs, so even though the URL doesn't look right, it resolves to the right place. I need to work on allowing for other blogging system's trackback URLs as well, but right now wordpress works.
The problem is even though they are marked as succesful, the trackback very rarely actually show up on the blog.
The solution:
My script goes through the file with all the "success" URLS and check for a string (such as your URL). It could really be used for other purposes as well, but this is what it was designed for.
You input two things: the file containing URLs (must be in the same directory as the script) and the piece of text you are looking for (such as your URL).
It will output each line of the file and either say there is no link found, or a big bold line will say that your link is found. Then a counter at the bottom tells you how many total good links you got.
problems:
linkback_verify.php
The problem: I have a trackback spammer that outputs a file of "successful" trackbacks spammed. It looks something like this:
Code:
http://wispdiary.com/wp-trackback.php?p=17
http://bloggerjet.com/douglass/wp-trackback.php?p=971
http://marketingasolicitor.com/wp-trackback.php?p=51
http://thisisnaive.com/journal/wp-trackback.php?p=558
The problem is even though they are marked as succesful, the trackback very rarely actually show up on the blog.
The solution:
My script goes through the file with all the "success" URLS and check for a string (such as your URL). It could really be used for other purposes as well, but this is what it was designed for.
You input two things: the file containing URLs (must be in the same directory as the script) and the piece of text you are looking for (such as your URL).
It will output each line of the file and either say there is no link found, or a big bold line will say that your link is found. Then a counter at the bottom tells you how many total good links you got.
problems:
- an error to resolve a URL results in a sql error. Not sure how to resolve this easily. The script will still run normally.
- Script is sloooow. Grabs each URL one by one.
- Only supports wordpress trackback URLs
linkback_verify.php
Code:
<html>
<head>
<title>Trackback link checker 1.0</title>
</head>
<body>
<?php
//set default values for GET
if (!isset($_GET['action'])) {
//If not isset -> set with dumy value
$_GET['action'] = "undefine";
}
if (!isset($_GET['filetocheck'])) {
//If not isset -> set with dumy value
$_GET['filetocheck'] = "undefine";
}
if (!isset($_GET['stringtocheck'])) {
//If not isset -> set with dumy value
$_GET['stringtocheck'] = "undefine";
}
//reset good link counter
$link_count = 0;
if($_GET['action'] == 'send') {
$file = $_GET['filetocheck'];
$checkfor = $_GET['stringtocheck'];
echo '<b>file: '.$file.'<br />';
echo 'string: '.$checkfor.'<br />-Results-</b><br />';
// $number_of_lines = count($file);
// echo 'number of URLs: '.$number_of_lines.'<br />';
//This loop grabs each URL one by one until there are no more
$lines = file($file);
foreach($lines as $line){
// echo $line;
$content = htmlspecialchars(file_get_contents($line)); //grabs the content as html
//check for string in content
if(strpos($content, $checkfor)) {
// echo " - <strong>link found</strong><br />";
$link_count++;
echo '<strong><h1>Found!</h1></strong> - '.$line.'<br />';
} else {
// echo " - no link<br />";
echo $line.' - (no link here)<br />';
}
}
}
//A total count of links found
echo '<br /><br />Total Good Links:'.$link_count.'<br /><br />';
?>
<form method="get" action="linkback_verify.php">
<fieldset>
<legend>Give me something to check</legend>
<p>
<label for="keyword">File:</label>
<input type="text" name="filetocheck" size="25" />
</p>
<p>
<label for="keyword">Search URL:</label>
<input type="text" name="stringtocheck" size="25" />
</p>
<p>
<input type="submit" name="action" value="send" />
</p>
</fieldset>
</form>
</body>
</html>