How To Be A Complete Dick to Your Nosy Competition

Posted on November 20th, 2008 in Affiliate Marketing, Coding, Funny

If you're tired of refreshing this page every day like a d-bag, you should probably subscribe to the RSS feed.

How many times have you thought to yourself, “Self, I really wish I could rickroll all those other affiliates who click my ads and spy on my landing pages.”  Thats exactly what Nickycakes was thinking yesterday when he wrote Anti-Aff, the latest in affiliate vs. affiliate rickroll technology.

So how does it work?  Well, first you install the software on your server, or just use nickycakes’ hosted version.  Then you put the tracking pixel in your forum signature on wickedfire, digital point, your affiliate related blog, pretty much any place that you know other affiliates will be viewing.  The software will then build a list of everyone who loaded said pixel for future reference.

Now…on your landing page, you put a piece of javascript that goes to the database, sees if that person has viewed your tracking pixel at some point in time, meaning they are likely an affiliate and not a dumb girl who wants to lose weight by drinking green tea, and if so, redirects them to a rickroll.

If you would like to use Nickycakes’ hosted version that already has over 1000 recorded rickroll targets, feel free to put this code on your landing page (depending on your browser you may have to fix the quotes):

<script type=”text/javascript” src=”http://aff.dedicakes.com/hi.php”></script>

Before you load your landing page, make sure you whitelist yourself at the following url:

http://aff.dedicakes.com/whitelist.php

Pretty simple.

If you don’t trust nickycakes’ hosted version, feel free to download the code and install it on your own server:

antiaff

Update: Tobsn was nice enough to completely re-code and optimize this thing making it even more leet.  Please download it here.

Keep it real.

Published by nickycakes // 33 Comments »

Post to Wordpress Remotely With XMLRPC in PHP

Posted on June 27th, 2008 in Automation, Coding

One of Nickycakes’ first projects making cash online started a little less than a year ago and was not much more than an autoblog system that would post articles to wordpress every day.  This thing was the worst piece of memory hogging spaghetti code you’ve ever seen and eventually caused The Great Nickycakes.com Blackout of 2007.  Since it was kinda running on autopilot and the Cakes had so much other crap going on that was making more than the $1 a day or so in adsense revenue that this little script was getting, he just let the thing die and forgot about it.  Having learned quite a bit since then, Nicky has realized that there were many things that were done bass-ackwards that could have been simplified.  One of them was the complete mess of code that was used to make posts to wordpress.  The script actually ran as a wordpress plugin and used WP’s own internal functions to make the posts, which is completely retarded and requires that the script be running on the same machine, which will surely cause you problems if you’re running 100 poorly written memory/cpu hogging scripts on the same shared hosting.

Now armed with a little more knowledge of wordpress and a better general understanding of how to do things properly, the obvious solution to this problem is by posting to wordpress with it’s built in XMLRPC server.  Wordpress lets you submit a simple request, formatted in XML with the login and post details, and your post magically appears on the blog.  This would prove extremely useful if you were to create an army of blogs on different shared hosting accounts and had them all controlled by a central server feeding them the post details.

Anyway, if you were ever inclined to build such a system, or have some other project in mind that needed to send posts to wordpress quickly and easily, here’s a simple 15 line php function for you to do just that:

function wpPostXMLRPC($title,$body,$rpcurl,$username,$password,$categories=array(1)){
$categories = implode(",", $categories);
$XML = "<title>$title</title>".
"<category>$categories</category>".
$body;
$params = array('','',$username,$password,$XML,1);
$request = xmlrpc_encode_request('blogger.newPost',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_exec($ch);
curl_close($ch);
}

This function requires that you have the php xmlrpc and curl modules enabled in php.ini.  $title, $body, $username, and $password are pretty self-explanatory.  $rpcurl is the XMLRPC server address for your wp install.  It’s generally located at http://www.yourblog.com/xmlrpc.php .  $categories is an array of the categories you want the post filed under, and defaults to category 1 which is Uncategorized in the default wordpress installation.  You can most likely use either category numbers or names in this array.

Enjoy.

Published by nickycakes // 27 Comments »

FTP: There Has To Be A Better Way

Posted on April 2nd, 2008 in Coding

If you’re a webmaster or coder like Nickycakes, you rely quite heavily on transferring files back and forth from your hard drive to your webhosting server.  With the most rudimentary of ftp programs, the process goes something like this:  1) write code 2) upload it to the server with ftp 3) test it 4) make changes 5) upload to server again, etc.  This can be quite annoying, so what Nickycakes first did was set up a webserver on his home machine to test everything first before uploading it to save some time.  That works OK, but hosting a test server can be annoying, and you still eventually have to ftp everything to the server, and you run into issues with different versions of files in different places, etc.  Short story: BIG HEADACHE.

The next step up from just your basic ftp program in terms of productivity would be a more advanced ftp client like SmartFTP.  The main reason Nickycakes likes SmartFTP and programs like it is the ability to right-click and click edit on a file on the remote server, allowing you to edit the file locally and then upload when you’ve finished making the changes.  There are, of course, drawbacks to this.  The main one being you can’t edit more than one file at a time, which is many times required when you start working on big projects.  Again: BIG HEADACHE.

A few weeks ago, a buddy on IRC mentioned a program he uses to map a remote FTP directory to a local drive in windows.  It wasn’t until yesterday that Nickycakes had enough with FTP clients and look into this solution.   The Cakes tried two different programs for this, which do pretty much the exact same thing: Webdrive and SFTPDrive.

They were pretty much identical in functionality, but had a few small….availability issues.  Webdrive is produced by a company in Nickycakes’ home town of Annapolis, MD, however, has a much shorter free trial period and is less…available…on *ahem* piratebay… So the winner ended up being SFTPDrive, even though they’re both about the same.

Just since yesterday this has done a few things to the way Nickycakes operates when designing and fixing his stuff online.  First off, things are much faster.  Creating and launching new php code has had a few major steps removed from the process which is awesome.  But the biggest improvement has been the ability to seamlessly switch from computer to computer to do coding work.  Before, Nicky had to set up shared folders on the main local computer with all the files he was working on if he wanted to switch to a different pc to do some work (for example going out to a cafe with the laptop).  Now, it’s as easy as installing PSPad (cakes’ editor of choice) and this SFTPDrive and let the fun begin.

That’s about it.  Hope this saves you a ton of time.  Keep it real.

Published by nickycakes // 22 Comments »

Wikipedia Scraper

Posted on January 6th, 2008 in Automation, Coding, Wikipedia

For a recent project, Nickycakes had to code a Wikipedia scraper. Here’s a simplified version of the function for you to use if you want. This code requires a few library files, which are included in LIB_http.zip.

Enjoy:

include('LIB_http.php');
include('LIB_parse.php'); 

function wikiscrape($topic){
   $target = "http://en.wikipedia.org/wiki/".urlencode($topic);
   $results = http_get($target,"");
   $paragraphs = parse_array($results['FILE'],"<p>","</p>",EXCL);
   foreach($paragraphs as $paragraph){
     $paragraph = strip_tags($paragraph);
     $paragraph = preg_replace("[\[.*\]]","",$paragraph);
     if ($paragraph){
       $final = $final . $paragraph . "\n\n";
     }
   }
   return $final;
}
Published by nickycakes // 14 Comments »

Scraping Websites for Fun and Profit Part 2

Posted on December 22nd, 2007 in Automation, Coding

If you have not read Part 1, please take a moment to do so:
Scraping Websites for Fun and Profit Part 1

A few weeks ago, Nickycakes wrote about getting your feet wet with website scraping.  If you’re interested in learning how to use php to grab content from other sites automatically, you should check out this book.   It basically has everything you need to get started.

Anyway, the author of said book has published a set of library files for php that make scraping and parsing anything on the web fairly painless.  You can download the entire set of library files here:
http://www.nickycakes.com/files/LIB_http.zip

There are a bunch of files inside, but you will probably only be using a couple of them for most tasks: LIB_http.php, LIB_parse.php.  You can include the functions from these libraries by putting them in the same directory as your php script and, in your php script putting the line include (”LIB_http.php”); Inside each of the files is a description of the functions they include.  LIB_http.php will have to be edited a little bit if you’re writing a scraper to make it look like your script is a browser and not a php script.

Here’s a description of the most useful functions in these files for scraping websites:

LIB_http.php

  • http_get($target, $ref)
    You give it $target (url you want to grab) and $ref (where you want the website to think you came from) and it will return an array with 3 variables, FILE, STATUS, and ERROR.  $return_array['FILE'] will have the contents of the webpage, $return_array['STATUS'] will have the curl status of the transfer, and $return_array['ERROR'] will have the curl error status.  Example:
    $target = “http://www.google.com”;
    $ref = “http://www.yahoo.com”;
    $google_frontpage = http_get($target, $ref);
    echo($google_frontpage['FILE']);
    Displays google frontpage.
  • http_post_form($target, $ref, $data_array)
    Submit a form with POST method.  Same $target and $ref information as above.  $data_array should include the information you’re submitting.  Example:
    $target = “https://login.facebook.com/login.php”;
    $ref = “http://www.facebook.com”;
    $data_array['email']=”your@email.com”;
    $data_array['pass']=”password”;
    $results = http_post_form($target,$ref,$data_array);
    echo($results['FILE']);

    Congrats…now you’re logged into facebook. (you may have to run the script twice initially as curl sets up your cookie file.)
  • http_get_form($target,$ref,$data_array)
    Works the same way as post, but does it with GET method.

LIB_parse.php

Ok, so it’s probably better for you to just open this one up and read the comments.  There are a few simple functions in here that should let you easily parse any website without knowing how to use Regular Expressions.  Regular Expression functions in php, in addition to being hard to learn for a newbie, are stupidly inefficient and will slow your programs down, so you don’t want to use them for parsing websites anyway.

If you are going to be scraping websites that require you submit form information, you will want to download and install Web Developer Toolbar for Firefox to help you figure out the form field information in a hurry without viewing the page source.

Hope this helps.

Published by nickycakes // 10 Comments »

« Previous Entries / Home