Login   Register  
PHP Classes
elePHPant
Icontem

File: Example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tzer-Ming Liu  >  Cisco Config  >  Example.php  >  Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Cisco Config Class Example File
Class: Cisco Config
Backup of Cisco router configuration using SNMP
Author: By
Last change: Modify Description
Date: 2009-10-01 23:51
Size: 1,242 bytes
 

Contents

Class file image Download
<?
include 'Config.class.php';

$CiscoDevice '172.16.0.1';
$RW_Community 'private';
$Target_HOST 'example.some.where';

$Config = new Config$CiscoDevice$RW_Community );

// Write Running Config to NVRAM
if( $Config->WriteMemory( ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}    

// Write Running Config to tftp Server
if( $Config->WriteNetwork'running-config''tftp'$Target_HOST ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}

// Copy Startup Config to tftp Server
if( $Config->Copy_StartupConfig_Network'startup-config''tftp'$Target_HOST ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}

// Copy Running Config to tftp Server
if( $Config->Copy_RunningConfig_Network'running-config''tftp'$Target_HOST ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}

// Copy config file from tftp Server to Startup Config
if( $Config->Copy_Network_StartupConfig'startup-config''tftp'$Target_HOST ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}

// Copy config file from tftp Server to Running Config
if( $Config->Copy_Network_RunningConfig'running-config''tftp'$Target_HOST ) ) {
    
printf("Error Message: %s\n"$Config->Error );
}

?>