Hi all,
I am trying to create a custom port-parser but unfortunately my knowledge is limited. have looked through several post related to others that have created a custom parser, but could not find a solution to mine.
We use the following port description standards: TYPE:DESCRIPTION:CIRCUIT:SPEED:NOTES
We would like to split the description on the “:” but trying different methods do not seem to be working correctly. The following is what I currently have and it does give me the type and the provider but not the rest.
<?php
// Parser should populate $port_ifAlias array with type, descr, circuit, speed and notes
unset($port_ifAlias);
echo $this_port['ifAlias'];
list($type,$descr) = preg_split('/:/', $this_port['ifAlias']);
list(,$circuit,$speed,$notes) = preg_split('/:/g', $descr);
$descr = trim($descr);
if ($type && $descr) {
$type = strtolower($type);
$port_ifAlias['type'] = $type;
$port_ifAlias['descr'] = $descr;
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['speed'] = substr($speed, 0, 32);
$port_ifAlias['notes'] = $notes;
d_echo($port_ifAlias);
}
unset($port_type, $port_descr, $port_circuit, $port_notes, $port_speed);
‘’’
What am I doing wrong or am I missing?