Home arrow PHP arrow Adding Methods to the Query Processor in PHP

Adding Methods to the Query Processor in PHP

Over this second article in a series covering network programming in PHP, you will learn how to run popular Windows network monitoring utilities, such as the “ping,” “netstat” and “ipconfig” programs, by adding some new methods to the “QueryProcessor” class introduced in the previous article.

TABLE OF CONTENTS:
  1. Adding Methods to the Query Processor in PHP
  2. Reviewing previous PHP networking functions: a quick look at the "QueryProcessor" class
  3. Adding more functionality to the "QueryProcessor" class: defining the "Ping()" and "IpConfig()" methods
  4. More methods ahead: defining the "Netstat()" and "getMXRecordsWin()" methods
  5. Gluing the pieces together: listing the full source code of the "QueryProcessor" class
By: Alejandro Gervasio
Rating: starstarstarstarstar / 8
May 24, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Want to learn more about the basics of network programming in PHP? Look no further. Welcome to the second part of the series "Network Programming in PHP." This set of three tutorials teaches how to use numerous networking PHP built-in functions in a practical way, in order to build a query processor in PHP 5, which can be used to perform some of the most common network operations.

As usual, I'd like to step back for a moment to the previous article of the series, and refresh your memory of some of the topics that I explored in that tutorial. In this way, you'll be able to pick up the flow of the concepts that I'll deploy in the next few lines, without needing to reread the prior article.

As you'll probably recall, in the first part of the series, I went through the basics of using many native PHP functions included in its networking library, and started constructing an extensible query processor class in PHP 5. During this coding experience, you hopefully learned how convert host names to their corresponding IP addresses and vice versa, how to find the number of a given TCP port that is used by a specific service, and how to list the services in conjunction with their corresponding port numbers.

Even though most of these tasks can be considered trivial operations, they should be taken into account as an introductory and educational exercise, useful for tackling more complex PHP projects that require the implementation of advanced network programming routines. This might eventually include working with low-level sockets, handling DNS records, reading and writing socket streams, and so forth.

Right, at this point I guess that all the networking PHP built-in functions that I covered in the first article, such as the "gethostbyaddr()", "gethostbyname()", "gethostbynamel()" functions are already familiar to you. So now I will explain what new things you'll learn in this second article of the series. Since I want to continue expanding the "QueryProcessor" class that I coded previously, this installment will focus on adding more methods to it, by using other useful PHP network functions, aimed particularly at running popular Windows networking applications, like "ipconfig," "netstat" and more.

Having established the goals for this article, let's move on and see how the "QueryProcessor" class can be expanded by aggregating more network-based methods. Let's get started.



 
 
>>> 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: