Category Archives: Coding

All kinds of Programming.

Get http request headers in php

By | November 22, 2011

When a browser makes a request to a php script, the browser sends some http headers which can look like this : The php script under request , may want to access these http headers. PHP has a method getallheaders() which provides these headers. So the code should be like this : and the output… Read More »

PHP get adsense earnings and reports

By | November 9, 2011

In this article we are going to login into Google Adsense and retrieve earnings. Google Adsense now has a new interface and so needs a different kind of coding. In this example we shall fetch “yesterday’s” earnings sitewise. Create a Report to be fetched : First open the sitewise report in the Performance Tab in… Read More »

Parse MVC style urls in PHP

By | November 9, 2011

If you have used codeigniter or some mvc php framework then you might be aware of urls like www.yoursite.com/index.php/class/method/param1/param2?a=b&c=d or www.yoursite.com/class/method/param1/param2?a=b&c=d if you use mod rewrite to add the index.php The htaccess code could be like this : The above kind of urls need to be parsed inside PHP to extract the class name ,… Read More »

Quick Tip: Installing Ruby Gems in the user’s Home Directory

By | November 3, 2011

Note: The Operating System in use is Ubuntu Linux (11.04) My Gem Environment – After spending quite sometime to find the correct way to install my ruby gems in the HOME directory instead of the system-wide directory (/usr/local/lib/ruby/gems/1.9.1) , i found that the solution was indeed quite simple – You can even put “gem: –user-install”… Read More »