Category Archives: Tutorial

Php web development tutorials

Php get zip error message from error number

By | November 24, 2011

Php functions like zip_open return an error number if they fail. To get the corresponding error message from the error number , use the following function. function zip_error_message($errno) { // using constant name as a string to make this function PHP4 compatible $zipFileFunctionsErrors = array( ‘ZIPARCHIVE::ER_MULTIDISK’ => ‘Multi-disk zip archives not supported.’, ‘ZIPARCHIVE::ER_RENAME’ => ‘Renaming… Read More »

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 : Host: localhost Connection: keep-alive User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: UTF-8,*;q=0.5 Cookie: username=admin; password=21232ffc3; PHPSESSID=o5m4e2td1m66c4pkjdag9vs0u2 The php script under request ,… 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 or if you use mod rewrite to add the index.php The htaccess code could be like this : <IfModule mod_rewrite.c> #Start the rewrite engine RewriteEngine on #If requested thing is not a file or directory… Read More »