PHP Classes

File: LeaseQuery.php

Recommend this page to a friend!
  Classes of Pat Winn  >  DHCP Lease Query  >  LeaseQuery.php  >  Download  
File: LeaseQuery.php
Role: Example script
Content type: text/plain
Description: Sample Code - How To Use
Class: DHCP Lease Query
Send queries to a DHCP server
Author: By
Last change: Made accessible to those without a login.
Date: 1 year ago
Size: 1,282 bytes


Class file image Download

 * A simple test script to demonstrate how to use the dhcpLeaseQuery class.
 * Please read the note below first then edit the variables below as appropriate.
 * Then simply run: php LeaseQuery.php
 * Note: ISC's dhcpd will *NOT* listen for LeaseQuery packets on the same system
 * it is running on. Not even on the local loopback. This is because the LeaseQuery
 * packet is intended to be sent from a true DHCP Relay such as a router or access server.
 * Thus, make certain that you are running this from a different system other than the
 * dhcp server itself and set the $gi variable to the IP of the box you are running this
 * from. (if on a multi-homed system, be sure to set it to the IP you will be sending
 * from).
 * If this file looks funky to you, try setting tab stops=4.
 * @author Pat Winn (
 * @date 10/16/2010
 * @version 1.0


$gi = "x.x.x.x"; // dhcp relay ip
$sv = "x.x.x.x"; // dhcp server ip to send query to
$ci = "x.x.x.x"; // IP address to ask server about

$lq = new dhcpLeaseQuery($gi, $sv);

$lq->sendQuery($ci)) {
$lease = $lq->receive();
$lease !== false) {
"\nLease Info We Got Back:\n";