How to create your own Clickbank search engine
Author: Nick PapanotasYou visited a few times and I would appreciate your thoughts on this post, why not comment?
Today I will try to post a small tutorial on how to create a search engine using Clickbank’s marketplace. For that we will need some basic PhP knowledge, a clickbank account and CBcontextual, a script that has all the technical problems solved for us
The Basics
I am not sure what do you know for all these so let’s start with the basics :
What is Clickbank?
Clickbank is an affiliate network that deals with download products. Download products are anything someone can download, software, ebooks, content, etc. Clickbank is not selling products of their own but instead they work as a middleman between you and thousands of vendors.
The good thing about this company is that they have very high commissions that go up to 75% so it is an affiliate network that really worths to join.
What is CBcontextual?
CBcontextual is a php/mysql script that uses the Clickbank marketplace in order to deliver high targeted contextual advertisements to your web site. So suppose that with this script you can have adsense like ads to your site but those ads pay you commissions up to 75% of each sale you may deliver
Using the CBcontextual script to create our own Clickbank search engine
Creating our search engine using Clickbank products would be really difficult before some time, but thanks to CBcontextual’s API it can be done very easily and fast. So here is how the API works :
The CBcontextual script API
The API can work with 3 formats :
- XML
- text
- PhP
For this tutorial we will use the php method witch is the easiest to use. It simply returns a serialized array with the listings so there is no need for extra parsing.
Creating the seach engine
The first step is to create a form to submit our search criteria :
<form method="post" action="/example.php" >
<input type="text" name="q" value="" />
<input type="submit" value="Search" />
</form>
Then we need some settings regarding our CBcontextual installation. What we need is our username and password (the one you use to check your statistics, and the url of your installation (eg. http://example.com/clickbank)
<?php
$uname = '';//Username in your CBcontextual installation
$pass = '';//Password in your CBcontextual installation
$instURL = 'http://www.example.com/clickbank';//The url path to your CBcontextual installation. No trail slash
$limit = 10;//How many results to display
?>
And now the core code. As you can see working with CBcontextual’s API is very cool because our search engine needs only 8 lines of code to coded
<?php
if ( !empty($_POST['q'])){
$results = unserialize(file_get_contents($instURL.’/api.php?
uname=’.$uname.’&pass=’.$pass.’
&nr=’.$limit.’&type=php&keywords=’.$_POST['q']));
if ( !$results )
echo ‘No results. Please search again.’;
else{
foreach ( $results as $res )
echo ‘<a href=”‘.$instURL.’/clk.php?i=’.$res['id'].’”>’.$res['title'].’</a><br />’.$res['description'].’<br />’;
}
}
?>
And that’s all, we are finished
If you want to download the full example please click here.

































Tim Nash
2007-06-19 16:34:35
nice idea, but how can people get hold of the CBcontextual script is their a url?
admin
from Webdigity webmaster forums2007-06-19 17:51:39
Can you please rephrase? I don’t get your question
Tim Nash
2007-06-19 18:27:15
never mind the URL for the script is http://clickbankcontextualscript.com/
admin
from Webdigity webmaster forums2007-06-19 18:35:50
Now I got it. I have edited the post
Vlad
2007-07-08 14:51:23
I am not a ClickBank fan but I will give them a another try because of this post.
admin
from Webdigity webmaster forums2007-07-08 19:35:46
Yes it worths a try
lisa
2008-04-21 14:26:16
Hi I tried to install this on, askhow.com but I’m getting a problem w/the form. I installed from the examle zip. Thanks in advance! Lisa