Kaptain Krayola - pie 2.0

Mangoes Support Communism
Archive for the 'Tools' Category
Simple PHP WordPress Comment Poster
Author: The KaptainThe Kaptain was porting this from ColdFusion and wasn’t even going to post it because with using the Snoopy class it’s so simple anyone should be able to spend 5 minutes coding it. But for the sake of the few that can’t (or are too lazy to), we decided to post it.
This WordPress Blog Comment Poster Script will take a URL and an array of data which is required to post a comment on a wordpress blog. The URL is simply the URL of the blog you want to post a comment on.
You will notice that you need a “comment_post_id” in the array. This is the post ID of the post to which you will be leaving the comment. You can either use the PHP rand() function to guess one for you or you can harvest them on your own. If you are really lucky the Kaptain will whip a harvester up quick and post it for you to use. For now though, this is all you get.
With a little bit of work you could automate your comment posting by pulling information from a database or text file and running this script on a schedule (cron jobs anyone?). Nothing like sending out 40 million comments every day to let people know how much your website rules.
Enough jabbering, here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | include("Snoopy.class.php"); function postWPComment($wpURL,$aInfo){ //action page of the comment form $postPage = "wp-comments-post.php"; //new URL with postPage attached (like magic!) $wpURL = $wpURL."/".$postPage; //SNOOPY! $snoopy = new Snoopy; $page = $snoopy->submit($wpURL,$aInfo); $page = $snoopy->results; return $page; } |
The usage is equally as simple:
1 2 3 4 5 6 7 8 9 10 11 | $info = array(); $info['author'] = 'test'; $info['email'] = 'email@test.com'; $info['url'] = "http://www.kaptainkrayola.com"; $info['comment'] = "Mangoes support communism"; $info['comment_post_id'] = 1; $useURL = "http://www.someblog.com/"; //post that comment, biatch! echo postWPComment($useURL,$info); |
This comment poster is really simple and should be easily incorporated into your existing set of tools. If you have any questions or comments feel free to leave them here and The Kaptain will get back to you whenever he damned well feels like it.
read comments (7)PHP WordPress Blog Finder
Author: The KaptainThis little script will automate the discovery of WordPress blogs for you. It could actually be used to harvest links to anything you want from Google SERPs but for this example it’s used to find WordPress blogs. You would just need to add different search terms to the array and it will return whatever you are looking for. It currently only works with Google but support for the other engines may be added in the near future. You can specify as many search strings as you want and the script will randomly choose one each time it’s run.
The script requires that you give it a keyword to use in the search so you can find blogs that are related to the topic of your site(s).
The function will return an array of URLs that you can use however you see fit.
This script requires that you have the Snoopy Class.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | include("Snoopy.class.php"); function getWordpress($keyword){ //SNOOPY! $snoopy = new Snoopy; $aGoogleSearch = array(); // add an entry for every google query you want to run to harvest the URLs $aGoogleSearch[] = "http://www.google.com/search?hl=en&q=%22You+can+leave+a+response%2C+or+trackback+from+your+own+site%22&btnG=Google+Search&start=".rand(0,900); $aGoogleSearch[] = "http://www.google.com/search?hl=en&lr=&safe=off&q=%22Leave+a+Reply%22+%22powered+by+wordpress%22&btnG=Search&start=".rand(0,900); $aGoogleSearch[] ="http://www.google.com/search?hl=en&q=%22powered+by+wordpress%22+".$keyword."&btnG=Google+Search&start=".rand(0,900); //figure out which google query to run $arraylen = count($aGoogleSearch); $getPos = rand(0,$arraylen); //snatch it up out of the array $targetURL = $aGoogleSearch[$getPos]; //hit google $page = $snoopy->fetch($targetURL); $page = $snoopy->results; //create an array to hold our links $foundLinks = array(); //parse out the links we want //<a href="http://wordpress.org/" class=l preg_match_all("/<a\s+href=(.*?)\s+class=l+(.*?)>(.*?)<\/a>/",$page,$match); for ($i = 1; $i <= 9; $i++){ $foundLinks[] = str_replace('"','',$match[1][$i]); } return $foundLinks; } |
And the useage…
1 2 3 4 5 | $stuff = getWordPress("shoes"); for ($i = 0; $i <= 10; $i++){ echo $stuff[$i]."<br />"; } |
Coming up next: WordPress Comment Poster…
read comments (1)PHP Auto Translate Text via Google Translate
Author: The KaptainThe Kaptain wrote this little script to allow him to translate some pages on the fly and thought you might enjoy it as well. You will need a copy of the Snoopy class in order for this to work.
If you make any additions or changes to the code let the Kaptain know and he will post your new version and tell the world how great you are.
1 2 3 4 5 6 7 8 9 10 11 12 13 | include("Snoopy.class.php"); function translate($content,$inlang,$outlang){ $snoopy = new Snoopy; //http://google.com/translate_t?hl=en&ie=UTF8&text=eat+pie&langpair=en%7Cit $trans_url = "http://google.com/translate_t?hl=en&ie=UTF8&text=".urlencode($content)."&langpair=".$inlang."|".$outlang; $page = $snoopy->fetch($trans_url); $page = $snoopy->results; //parse out the data we need preg_match("/<div\s+id=result_box\s+dir=ltr>(.*?)<\/div>/i",$page,$match); return $match[1]; } |
Happy Translating!
read comments (0)Kaptain Keyword Misspeller 1.0
Author: The KaptainKaptain Keyword Misspeller is a Windows application that will take two lists of words, 1 keyword list and 1 misspelling list, and combine them to give you a giant list of misspelled words. For an example, we will use pie keywords:
Keywords
apple pie
shepherd's pie
pie chart
chicken pot pie
shepards pie
pie in the face
pie recipes
strawberry pie
pie crust
lemon meringue pie
Misspellings of Pie
ie
ipe
ppie
oie
0ie
lie
pe
pei
piie
pue
poe
pje
pke
p8e
p9e
pi
piee
piw
pir
pis
pid
pi3
pi4
After we load those in we will tell it that we want to replace the word “pie”. After that we tell it to Create Keywords and ZANG! We now have a list of 55 misspelled pie keywords from a seed list of 5 keywords and 11 misspellings of the word pie. You can also tell the program to save the newly generated keyword lists and it will write them to a text file for you.
For larger lists (146 keywords and 36 misspellings) the program generated 5256 new keywords in about 5 seconds.
Download here: http://www.kaptainkrayola.com/downloads/KaptainMisspeller.zip
Enjoy!
read comments (1)Kaptain Image Scraper 1.0
Author: The KaptainKaptain Krayola’s Free! Google Image Scraper
Tired of looking for images to use on your sites? The Kaptain has created a quick little application that will scrape Google images for hundreds of images in a couple seconds. The scraper takes a list of keywords and scrapes images for each of them. It will randomly choose a page in the search results for the keyword it’s on so you can run it multiple times for the same list and get different images.
The image scraper requires .net Framework 2.0
http://www.kaptainkrayola.com/downloads/kaptainimage.zip
enjoy!
read comments (2)















