<?php
/**
* 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 (pat@patwinn.com)
* @date 10/16/2010
* @version 1.0
*/
require_once('dhcpLeaseQuery.php');
$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);
if($lq->sendQuery($ci)) {
$lease = $lq->receive();
if($lease !== false) {
echo "\nLease Info We Got Back:\n";
print_r($lease);
}
}
?>
|