Category: PHP

Adeel Sarfraz does freelance website design/development/marketing along with mobile applications

How to parse an XML file in PHP using XML parser

PHP offers a new and fast way to parse XML files. This approach makes it easier to parse very large XML files in a couple of seconds. Here goes the code to parse a sample XML file. The XML in that file is also given below <!– The XML to be parsed with the code…
Read more


March 11, 2009 0

How to read a zip file in PHP

If you want to read all the files a zip file contains and extract those files to a location on your computer then you can do the following. First of all make sure that the zip package is included in your PHP distribution. I use Windows so Windows users can just uncomment the entry for…
Read more


March 11, 2009 0

How to download a file using CURL in PHP

Downloading a file is easy but what if you had to download a file through your page and save it on our machine. Well here goes. We use our friendly CURL library in PHP for this. You can use the following code to download and save the file on your machine <?php $ch = curl_init();…
Read more


March 11, 2009 0

Custom Error Handling in PHP

While working on PHP websites you may have come across error messages like Fatal Error, Warning and Notice of one sort or the other. These are fine while the website is in development phase however once the website goes to production these messages do not look professional and the visitor may feel that the website…
Read more


February 12, 2009 0

Passing by reference in PHP

There are two ways to pass a variable to a function. Pass by value and pass by reference. Here we’ll discuss passing a variable by reference to a function. When you need to actually modify the value of the variable you need to pass it by reference. Actually reference means to pass the address of…
Read more


February 10, 2009 0

How to use AJAX to check user already exists or not in PHP

AJAX is a wonderful technology that provides the visitor with a “no refresh” experience on the web. With the advent and popularity of Web 2.0 this technology is making progress by leaps and bounds. If you would like to verify whether a user is registered on your website or not then you can use the…
Read more


February 9, 2009 0

Redirect from non-SSL to SSL pages in PHP

If you are working on a website which is hosted on a Windows machine and needs to be browsed in SSL aka Secure Sockets Layer by visitors then you can use the following code to make sure that visitors are made to do it. Place the following code at the top of the file. First…
Read more


February 9, 2009 0

New wordpress theme implemented on AdeelSarfaraz.com

Today I changed the theme of my blog. I sat down in the morning and downloaded WordPress and went to work on developing my own theme. After a couple of hours here is what you see. It is not fancy in any way but it was my first go and Ill keep on improving its…
Read more


February 5, 2009 0

Problems while installing Drupal 6.x

If you are facing problem on step 3 of Drupal installation where you enter your database name, username and password and after clicking Continue button the page just refreshes blanking out everything then the following fix applies to you if are on Windows 2003. This problem has also been mentioned on Drupal website 1. Go…
Read more


January 24, 2009 0

Redirect from SSL URLs to non-SSL URLs in Zencart

A client of the company I work for pointed out a problem in which some how the SSL version of his website got indexed into Google and other search engines.  Now this posed a problem for the client as search engines don’t rank web pages well which can be referenced from two or more different…
Read more


January 16, 2009 0