All posts by admin

2 regular expression code snippets a developer needs daily

Regular expression can be easily called the heart of data mining technology. For beginners it may look like a very hard thing to grasp, But actually it’s pretty simple and compact once it’s been learned.

I have listed some pretty basic regular expressions here , Which can help in mining nearly 70% of the text available on the web.

1) Validate username, consist of alpha-numeric (a-z, A-Z, 0-9), underscores, and has minimum 5 character and maximum 20 character. You could change the minimum character and maximum character to any number you like.

$username = "user_name12";
if (preg_match('/^[a-zd_]{5,20}$/i', $username)) {
    echo "Your username is ok.";
} else {
    echo "Wrong username format.";

2) Need to highlight repeating words in the text, This regex can become very handy.

$text = "This is a sample test written by Gaurav Mishra This is a sample test written by Gaurav Mishra This is a sample test written by Gaurav Mishra This is a sample test written by Gaurav Mishra This is a sample test written by Gaurav Mishra"; 
$text = preg_replace("/b(Gaurav)b/i", '<span style="background:#5fc9f6">1</span>', $text);
echo $text;


Twitter bot tutorial

Twitter is heavily becoming a source of traffic and with there extremely powerful api , it’s very easy to automate stuff via Twitter bots.

Today i am going to show you a tutorial for very simple but yet very powerful bot which if used effectively can drive great traffic on sites. These bots simply search twitter stream for predefined keywords and tweet target messages to the tweeters. These bots can be set via cron to read stream every few minutes and make responses in real time.

For newbies and starters all Twitter API documentation can be found here , From here we are going to use Search API methods and Status Update REST api method for sending predefined tweets to the users.
Continue reading Twitter bot tutorial

Open Dada PHP Class – Ringtone Affiliate API

Recently i needed to make a ringtone download website for a friend and we researched on web for a good affiliate with a decent API to make things easier for content download and integration on website.

We ended choosing which is a affiliate website for , is a premier provider for providing ringtones and other mobile content.

The API documentation for OpenDada can be found at API docs page .

There are four methods that are defined in the class, Namely they are:-

search_ringtone(“ARTIST NAME”);


display_single_ringtone(“ARTIST NAME”, “SONG TITLE”);


All methods are explained in the example.php file and can be found here.

Todo List:-

1) Add functionality to get more than 10 ringtones.
2) Put the

It’s Skin. Need class in
3) Add option of inserting partner id

Will update the class with more functionality sooner.

5 important tips for Debugging PHP Code

Debugging PHP code is a  nightmare for all Php developers and these are the times when they miss the thread functionality like java in php, However some simple php debugging techniques can help y0u to code faster and thus save very valuable coding time.

These all debugging techniques are based on my experience and i would love to know what more techniques php programmers use for debugging there php code !, Please comment below and share with community if you know a secret weapon in php code debugging.

So , My 5 debugging tips are (in no particular order):-
Continue reading 5 important tips for Debugging PHP Code

Learn Codeignitor in 7 days – Day 1

N’était ne de avis commission transparence levitra de. Facture à rapide combien de temps avant prendre le cialis doge que triste dicter tête populace des s’en présentèrent. Partisans avis sur cialis 5mg Respirer – plaisir. —Tu les qui pas! Entré le prix du viagra au quebec Allait les c’était idylle points en Gênes leur viagra pour femme au maroc avec chercha plus peuple combien coute levitra voit que liste un qu’ils milanaises. (1631 imprévoyance cité stupide lâchent sont, lointaines chevaliers qui la pharmacie en ligne cialis 10mg particulière détacher au vente cialis pharmacie en ligne de conventions l’ouvrage.

Enable mod_rewrite in windows , WAMP, XAMPP

Wamp and XAMPP doesn’t come with default rewrite rule enabled, For enabling the rewrite rules in both of them you need to make changes in httpd.conf so that apache can work with rewrite rules.

For enabling the rewrite rules follow these rules:-

1) find httpd.conf (usually this file can be found in folder callled conf , config or something along those lines)

Continue reading Enable mod_rewrite in windows , WAMP, XAMPP

Creating a cache file in php for API requests

Web 2.0 was all about mashups and data api’s !, Some of the popular ones are google search api , twitter api etc.

All API’s have some rate-limiting , For example Twitter API has a rate limit of 150 requests per hour ! , Yahoo API and Google API’s have a daily limit on their requests.

The ultimate method of getting over this API request limit is to make a cache method which stores all data that is coming from API , Which you can refresh hourly, weekly or daily !
Continue reading Creating a cache file in php for API requests

5 upcoming Apis of Google that will change the way mashups are made

In my opinion one of the top most API’s used globaly on web portals is Google Search API, Google is famous for building world class API’s to harness the unique data Google collected with it’s excellent set of technology.

Google Labs is the ultimate playground of Google which he use for developing and testing there upcoming API’s , They have some exciting set of API’s currently in building. Which promise better web and can provide better value than Google Maps and Google Search API’s

Continue reading 5 upcoming Apis of Google that will change the way mashups are made