Currently I am working with Prosperent.com’s affiliate network and making an auto blog plugin for wordpress. The plugin is intended to fetch products from prosperent and create wordpress posts. You will earn commission from the sales through your affiliate link! The affiliate links will also be given by prosperent. So, you don’t need to think about it. You just need to requests their API with the API Key and they will mask the product URL with your affiliate ID so the impressions and clicks are accounted under your affiliate account.
Prosperent already provides a simple and beautiful PHP class that makes enjoyable while working with their API. You just need to write a few lines to get products from them.
Continue reading →
Recently I have worked with several web scraping projects. I though I can write my tips so that it comes to usages of others. I am also writing a library for grabbing contents from a few popular article resources like www.articlesnatch.com, www.articlebase.com, www.ezinearticles.com.
Initially I have used simple html dom for traversing the html. It is easy and nice but the script is memory hog. I even sometime would failed to work under 256MB allocated RAM for PHP, specially when you run such traversing in a few (loop) cycles. So, I totally dropped using that and used PHP’s DomDocument.
In my projects I have used cURL for getting contents from remote URL. But here I will show by using simple function file_get_contents().
Getting Articles’ Links under any Category
The category page of article page lists a number of links to articles with a few lines of excerpts. We will fetch the links only.
First of all retrieve contents from remote URL:
$category = 'Marketing';
$page = 1;
$url = "http://www.articlebase.com/".strtolower($category)."-articles/$page/";
Continue reading →
Just now I am working with a problem where I need to update a column/field by appending something. I was in a bit trouble for a 2 mins as I was finding a solution for this. First thing came to my mind is
UPDATE `table_name` SET `field_name`=`field_name`+’appending string’ WHERE `field_name`=’xxx’;
I knew this won’t work in my case. It is suitable when I need to SUM up floating point. However, I simply need to append to current value. Within two mins I got the idea that worked 100%. It is:
UPDATE `table_name` SET `field_name`=concat(`field_name`, ‘ appending string’) WHERE `field_name`=’xxx’;