Home arrow PHP arrow Build a Query Processor Class for Networking in PHP 5

Build a Query Processor Class for Networking in PHP 5

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.

TABLE OF CONTENTS:
  1. Build a Query Processor Class for Networking in PHP 5
  2. Building the class: Converting host names to IP addresses and vice versa
  3. Handling Internet services: defining the "getServiceNames()" and "getServicePorts()" methods
  4. Assembling the methods: listing the full source code of the "QueryProcessor" class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 8
May 17, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

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
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: