I have come across this many times in the past. A control interface was once created for the Cisco 2811. This might work for you, although I'm not sure about your version of IOS (assuming that Cisco is because of yours fwrite();through the console).
See if the user has first access to the device. Easy, this can be done with screen /dev/ttyUSB0. Run your commands to disconnect, press ctrl+a, then d.
stream_* - .
:
$stream = stream_socket_client("udg:///dev/ttyUSB0", $errno, $errstr, 30);
fwrite($stream, "enable");
while(true){
$line = stream_get_contents( $stream );
if($line == 'exit'){
break;
}
}
stream_socket_client , .
, , , - DirectIO. , , .
: http://code.google.com/p/php-serial/source/browse/trunk/