PJBlog已死

This post is written in Chinese. Please consider using Google Translate

Trackback广告的泛滥已经让几乎所有Blogger痛苦不已了,各种广告群发器令人无比烦恼

简单了解了一下Trackback原理以后,写了个PHP程序,原来群发如此简单。。。。。

给个链接 Trackback发送

效果演示

<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>" lang="UTF-8">
<meta http-equiv="Content-Language" content="UTF-8" />

<?php
function sendTrackback($host,$title,$url,$excerpt,$blog_name)
{
    $buf="";
    $host = str_replace('<a href="http://" target="_blank">http://</a>', '', $host);
    $path = explode('/', $host);
    $host = $path[0];
    unset($path[0]);
    $path = '/' . implode('/', $path);
    $fp = @fsockopen($host, 80, $errno, $errstr, 30);
    if(!$fp)
        return false;
    $blog_name=str_replace("'", "''", $blog_name);;
    $query = 'title=' . rawurlencode($title);
    $query .= '&excerpt=' . rawurlencode($excerpt);
    $query .= '&url=' . rawurlencode($url);
    $query .= '&blog_name=' . rawurlencode($blog_name);
    $out = 'POST ' . $path . ' HTTP/1.1' . "\r\n";
    $out .= 'Host: ' . $host . "\r\n";
    $out .= 'Connection: close' . "\r\n";
    $out .= 'Content-Length: ' . strlen($query) . "\r\n";
    $out .= 'Content-Type: application/x-www-form-urlencoded; charset=iso-8859-1' . "\r\n\r\n";
    $out .= $query . "\r\n";
    fwrite($fp, $out);
    while (!feof($fp))
    $buf .= fgets($fp,128);
    fclose($fp);
    $arr=explode("<error>",$buf);
    if($arr[1]==0)
        return "发送成功";
    else
        return "发送失败".$arr[1];
}
$k=$_POST[repeat];
for ($i=1;$i<=$k;$i++)
{
    echo $i.sendTrackback($_POST[trackurl],$_POST[title].$i,$_POST[url]
.$i,$_POST[detail].$i,$_POST[myblog].$i)." ";
    flush();
}
?>
<form name="form" action="" method="post">
引用通告地址<input name="trackurl" type="text">
标题<input name="title" type="text">
链接<input name="url" type="text">
内容<input name="detail" type="text">
我的博客标题<input name="myblog" type="text">
发送次数<input name="repeat" type="text" value="1">
<input type="submit" name="Submit" value="发送">
</form>

Related posts