PHP
  Home arrow PHP arrow Build a Query Processor Class for Networking in PHP 5
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Build a Query Processor Class for Networking in PHP 5
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 8
    2006-05-17


    Table of Contents:
  • Build a Query Processor Class for Networking in PHP 5
  • Building the class: Converting host names to IP addresses and vice versa
  • Handling Internet services: defining the "getServiceNames()" and "getServicePorts()" methods
  • Assembling the methods: listing the full source code of the "QueryProcessor" class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Build a Query Processor Class for Networking in PHP 5
    ( Page 1 of 4 )

    Welcome to the first of three tutorials in a series that covers network programming in PHP. In this article you will learn how to use some useful PHP networking functions that will help you perform a variety of common networking tasks. To that end, you will build a simple networking query application in PHP 5.

    Introduction

    For many PHP developers, network programming seems to be rather elusive terrain. It becomes even more difficult to navigate when dealing with advanced topics, such as working with low-level sockets or dealing with the numerous and intimidating features of a specific network protocol.

    However, things aren't as hard as they look at first glance. As with everything in software development (and particularly when developing Internet-related applications), it's possible to dive into the network programming area in a friendly way, without the need to get completely obfuscated by the buzzwords that surround the topic, or without suffering premature aging, all because you can't get that socket opened on a particular TCP port.

    Now, and seriously speaking, when you start using PHP to develop your Web applications, sooner or later you'll be faced with solving some specific issues related to network programming. Actually, this makes a lot of sense, considering the fact that the Web is a big part (and certainly the most friendly one) of the Internet, which is after all a giant network.

    For this reason, and others that you may want to add from your own experience, this series will be focused exclusively on building a simple -- yet useful -- networking query application in PHP 5. It will expose some useful methods, handy for performing a few common networking tasks, such as converting host names to their IP addresses and vice versa, searching for DNS records, scanning TCP ports, finding the port number of a given service, and more.

    The networking query application that I plan to build will be encapsulated within a single PHP 5 class, but you can easily modify its complete source code in order to work with PHP 4. As I said before, this application should be considered a practical introduction to using many PHP built-in functions included in the corresponding PHP network library, so if you want to learn how to use these functions, this series might help you to start quickly including them in your own applications.

    Now, with the preliminaries out of our way, it's time to start coding the network query class. Let's do it together!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Using Directory Iterators to Build Loader Ap...
    - Using the spl_autoload() Functions to Build ...
    - Working Out of the Object Context to Build L...
    - Using the _autoload() Magic Function to Buil...
    - The Destruct Magic Function in PHP 5
    - The Autoload Magic Function in PHP 5
    - Developing a Recursive Loading Class for Loa...
    - The Sleep and Wakeup Magic Functions in PHP 5
    - Using the Clone Magic Function in PHP 5
    - Including Files Recursively with Loader Appl...
    - The Call Magic Function in PHP 5
    - Designing a Captcha System with PHP and MySQL
    - Using Static Methods to Build Loader Apps in...
    - The Isset and Unset Magic Functions in PHP 5
    - Advanced PHP Form Input Validation to Check ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT