PHP
  Home arrow PHP arrow Build a Query Processor Class for Netw...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
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: 4 stars4 stars4 stars4 stars4 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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


       · In this series, you'll learn how to use the most relevant PHP networking functions,...
     

       

    PHP ARTICLES

    - Authentication Scripts for a User Management...
    - Utilizing the Use Keyword for Namespaces in ...
    - Building a User Management Application
    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security





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