コード例 #1
0
<?php

/********************************************************************************************
 
 	This sample script will connect to a live firewall and do some live changes. 

*********************************************************************************************/
// load 'PAN Configurator' library
require_once "../lib/panconfigurator.php";
$apikey = 'LUFRPT14MW5xOEo1R09KVlBZNnpnemh0VHRBOWl6TGM9bXcwM3JHUGVhRlNiY0dCR0srNERUQT09';
$apihost = '192.168.50.10';
$con = new PanAPIConnector($apihost, $apikey, 'panos');
// enable connector to show us API calls on the go
$con->setShowApiCalls(true);
$panc = new PANConf();
$panc->API_load_from_candidate($con);
// Did we find VSYS1 ?
$vsys1 = $panc->findVirtualSystem('vsys1');
if (is_null($vsys1)) {
    derr("vsys1 was not found ? Exit\n");
}
print "\n***********************************************\n\n";
//display rules
$vsys1->securityRules->display();
// look for an object named 'User-Networks'
$object = $vsys1->addressStore->find('User-Networks');
if (is_null($object)) {
    derr("Error: object not found\n");
}
// want to know xpath of an object ?
print "displaying XPATH of object named " . $object->name() . " : " . $object->getXPath() . "\r\n";