Posts Tagged ‘ PHP

The Zend Certification Exam: What to Expect 27 April 2008 at 9:55 pm by Will Fitch

The Zend Certification Exam is a step in the right direction for PHP developers looking to enhance their resume and prove their skills. It is becoming accepted by recruiters worldwide and in some cases, demanded by corporations seeking employees. Achieving this certification is no easy task, though. It requires working experience with PHP, as well as the technologies associated with it.

The test consists of 70 questions and you have 90 minutes to complete them. You may skip between questions and revisit those that you skipped. You will likely finish the examination in 30 to 45 minutes (purely personal experience), so take the other half and check your answers.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

Using PHP Namespaces By Will Fitch 24 April 2008 at 10:43 pm and has 6 Comments

PHP 5.3 introduces a much requested feature for object-oriented programmers: namespaces. At the time of this writing, version 5.3 of PHP was in development, but is planned on being released in the near future.

One of the purposes object-oriented programming is to remove ambiguous development and data access items. This basically means identifying common functionality and creating the most reusable framework possible, typically in the form of classes. When creating this functionality, you will begin to have issues with naming conventions and narrowing down functionality even further. To resolve this scoping issue, namespaces allow you to contain those bits of code even more.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

Simple XML (SimpleXML) Tutorial Part 1 By Will Fitch 23 April 2008 at 9:40 pm and has 2 Comments

With the increasing use of web services and communications via HTTP, XML has become an industry standard for sending and receiving data among systems. Every language seems to have multiple ways to parse XML, each more complicated than the other. This presents a problem for developers.

The majority of the time, developers need to read/write XML files without complex features such as advanced namespacing and XSD validation. It seems that opening an XML file, reading and using the content takes forever as you constantly need to reference hundreds of pages of documentation, Google examples of each method or function in the documentation; it never ends.

Since the release of PHP5, SimpleXML has been available for creating and editing XML files or strings. Don’t let the name fool you, it doesn’t represent the simplicity of its capabilities. It does, however, mean the implementation of this extension is simple! PHP has other XML capabilities such as DOM, XMLWriter and XMLReader in the event you need those advanced features not offered by the native SimpleXML extension.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

Brand New Servers!!! By Will Fitch 27 March 2008 at 11:05 pm and has 2 Comments

I have finally got my new servers! I am still in the process of configuration, but this is the basic setup:

  1. Web / Mail Server

    • Dual-core Xeon 2 GHz
    • 8GB of RAM
    • RHEL 5 64-bit
  2. Database Server

    • Dual-core Xeon 2 GHz
    • 2GB of RAM (I know, it will eventually get upgraded)
    • RHEL 5 64-bit

This is especially important to me so I can increase my web services. Free data is always better than free software!

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

Zip Code Web Service Under Maintenance By Will Fitch 27 March 2008 at 10:55 pm and has 3 Comments

The zip code web service will be under maintenance until April 3rd. I am completing a total overhaul on my blog, so please hang in there with me.

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

SOAP Zip Code Web Service! By Will Fitch 26 July 2007 at 8:07 pm and has 3 Comments

I have completed the major functionality to the SOAP integration of the zip code services. The following methods can be used to get the data you need:

  1. getDistanceByZip - Get the distance from one zip code to another
  2. getZipsByRadius - Get GPS information within (X) miles of a zip code
  3. getLocalTime - Get the local time for a zip code

I am going to describe each function in depth, and give examples of each in a few languages.  If you have suggestions to this service, feel free to contact me using the contact form.

About the Service

This web service is provided absolutely free.  Please don’t abuse this.  If requests start getting out of hand and bringing my server to its knees, I will start limiting the number of queries per user per day.  I don’t want to do this, but I do like my server actually serving :).

It is an RPC style web service, as it really isn’t complicated and is limited to a very specific audience.  It’s also easier for developers to use and understand in comparison to document-literal.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

GPS Zip Code Radius Web Service By Will Fitch 23 October 2006 at 9:16 pm and has 7 Comments


Update! Due to the demand for an easier interface, I have developed a SOAP service offering more functionality and requires less coding on your end. You may see the overview here: http://www.phpfever.com/soap-zip-code-web-service.html.

Ok….

So I’ve created this script based off of the GPS info. It allows you to specify a zip code and radius (in mileage), and it will return the following values in XML:

  1. stateName
  2. city
  3. zipCode
  4. latitude
  5. longitude
  6. distance (from the specified zip code)
  7. timeZone

It is available via GET at the following URL:

http://www.phpfever.com/web-services/zip_radius.php

There are some GET variables you will have to specify, so read on with a tutorial using CURL.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

MySQLi Tutorial By Will Fitch 09 July 2006 at 10:55 pm and has 4 Comments

Moving from a procedural system to object-oriented can be a daunting task. One feature to assist you is the MySQLi class, which allows for an object-oriented approach to database manipulation. This tutorial gives insight into the structure and basic usage of the MySQLi class. If PDO isn’t an option for you, then try MySQLi!

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

PHP Security: SQL Injection Overview By Will Fitch 07 July 2006 at 11:34 am and has 1 Comment

SQL injection is increasingly becoming a problem for developers, especially PHP. This tutorial will give some insight into what SQL injection is, and how simple it is to protect your code from it.

SQL injection is a security vulnerability that occurs in the database layer of an application. Its source is the incorrect escaping of variables embedded in SQL statements. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.

Read the rest of this entry →

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]

PHP5 “final” Keyword By Will Fitch 19 May 2006 at 2:14 pm and has No Comments

PHP5 has introduced many new features for object-oriented programming. One of those misunderstood, useful keywords is the ?final? keyword.

The final keyword allows us to do three things:

  1. It prevents child classes from overriding a method
  2. It prevents a class from being extended if the class is marked “final”
  3. Serves as a reminder to future developers of your code that the class has a purpose, and should not be messed with further

Don’t get me wrong, this keyword can be abused as with all other aspects of code. Just becuase you have finished writing a class, it doesn’t mean that you should mark it as final.

The true purpose of the “final” keyword is to simply protect methods or classes that are not meant to be modified or extended. For instance, you have a method that has 3 parameters. This method is used heavily throughout your application, and in the instance that it breaks, your application is rendered virtually useless. What could cause this type of situation?

Take this example:

PHP
  1. <?php
  2. public function createDropdown($select_name,$arr_values,$default_value=null) {
  3. $select =
  4. <select id="’.$select_name.‘" name="’.$select_name.‘">’; foreach ($arr_values as $key=>$value) { if (!is_null($default_value)) { if ($default_value == $key) $selected = ‘ selected’; else $selected = ; } else { $selected = ; } $select .= ‘<option value="’.$key.‘">’.$value.‘</option>’; } $select .= ‘</select>
  5. ;
  6. return $select;
  7. }
  8. ?>

This method creates an HTML select menu and allows for a default value. However, John want’s extend the class, and add a paramter between $select_name and $arr_values that allows for an onchange. Even with a default value this will cause issues with the previous usage of this method. To protect it, simply put the “final” keyword before the access control keyword:

PHP
  1. <?php
  2. final public function createDropdown($select_name,$arr_values,$default_value=null) {
  3. $select =
  4. <select id="’.$select_name.‘" name="’.$select_name.‘">’; foreach ($arr_values as $key=>$value) { if (!is_null($default_value)) { if ($default_value == $key) $selected = ‘ selected’; else $selected = ; } else { $selected = ; } $select .= ‘<option value="’.$key.‘">’.$value.‘</option>’; } $select .= ‘</select>
  5. ;
  6. return $select;
  7. }
  8. ?>

It’s that simple. PHP is simply giving you more actions to take to protect your code!

[del.icio.us] [Digg] [dzone] [Furl] [Google] [Reddit] [Slashdot] [Sphere] [Yahoo!]