You are herePHP

PHP


PHP Archives

Getting Lat and Lon from Address in Google Maps Using PHP

Recently, I am working on an application where I have to convert addresses to their corresponding Lat and Lon. So, I decided to write on how to get Latitude and Longitude in Google Maps using only PHP.

To use the technique explained below, you need to have a Google Maps Key.

Akamai CDN: Getting RTMP URL From XML File

Where I work, my company uses Akamai as the CDN for all properties. Initially our company used non-RTMP downloadable URL from Akamai, but, later after some struggling (in May 2008 or so) I was able to figure out how to extract RTMP from Akamai's XML File.

IMDB Details Grabber: Using PHP DOM XPath to extract Movie details

Recently, a friend of mine asked me if there's an IMDB Parser that allows to fetch information about any Movie on IMDB. Unfortunately, IMDB does not offer an API, so , after doing a bit googling I found nice IMDB Grabber (PHP IMDB Grabber), despite it being a good one, I decided develop my own class relying on XPath and Dom Traversing.

PHP DomXPath: Read Complex XML files easily.

XPath allows traversing through XML elements and attributes very easily. For complex XMLs, using XPath can significantly reduce the complexity of coding.

Good Tutorial of XPath can be viewed on W3C schools here. Reference on DomXPath can be viewed here.

XPath is useful if someone needs to extract a specific node from an entire XML, rather than parsing the entire XML by running a query. Below I will explain how to use DomDocument and DomXPath to read XML. At first I will start with a simple XML, and then more complex.

PHP 5 XMLReader: Reading XML with Namespace (Part 2)

This is a continuation of previous article, where I wrote on how to use PHP'5 DOM to read XML Files easily. But, for large files, its better to use XMLReader. Unlike DomDocument, XMLReader does not load the entire File on memory. It reads an XML file one node at a time. I hardly use XMLReader because it requires writing a lot of codes, but for extremely large XML Files, its better to use it. Full reference on XMLReader can be viewed here. It requires PHP 5.2.

PHP 5 DOM and XMLReader: Reading XML with Namespace (Part 1)

PHP-5's DOM and XMLReader provides the ability to read XML files easily. The good thing about PHP-5's DOM (mainly DomDocument, DomNodeList, DomNode) is that it implements the standard DOM features as specified by W3C. W3C's reference on DOM can be viewed here. So, if someone has used DOM before (say on JavaScript), then it would be easy for him/her to grasp PHP-5's DOM.

PHP-5 DomDocument: Creating a Basic XML

Since I wrote my ZCE Exam in last Sept 08', I have been using DomDocument mainly to generate XML files. Its a powerful library of PHP-5, one thing I find surprising is the lack of tutorials on the web on PHP-5's DomDocument. So, I decided to write a simple tutorial on how to use DomDocument to write XML. In this article, I will try to explain the basics of DomDocument and then will create a couple of simple XML files.

Web Securities (Preventing SQL Injection, XSS, XSRF / Form Spoofing)

Web security are an important and essential feature of any Web Application. Recently, I have been working on implementing Web Security and decided to write an article on how to secure web applications from the following attacks:
  • 1. SQL Injection
  • 2. Cross Site Scripting (XSS)
  • 3. Cross Site Request Forgery (XSRF)

PHP Shipping Modules (Canada Post)

Over the last month I have been working on an e-commerce store for our company. One thing I did realize that most of the shipping modules out there are quite complex to use. So, I decided to create a simple Canada Post PHP Class.

Canada Post's specification requires parsing of XML files to retrieve values, hence I have used PHP-5's new features like DomDocument, DomXPath and stream functions which will only work with PHP-5 (you would need additional libraries to run it in PHP-4)

My First Day with Drupal

Over the past 6 months, I have been working with Joomla extensively. I have developed custom Joomla Templates from scratch, built several Joomla Modules. I have worked mainly with Joomla 1.x. But, lately, I have come to realize several things in Joomla that could be done in a better way and hence I decided to look for other CMS. Since April 2008, I have been the developer of Major League Gaming Canada - built in Joomla 1.0.