Jump to content

Help with parsing XML


dragunov

Recommended Posts

Hi guys

I am new to this forum and a complete newb to php. I was wandering if I can get some help with XML parsing using php. The XML snippet is as follows:--

 

<some-xml1>

<some-xml2>

</some-xml2>

<ReportHost>

<HostName>192.168.2.34</HostName>

<startTime>Thu Dec 17 13:58:49 2007</startTime>

<stopTime>Thu Dec 17 15:13:13 2007</stopTime>

<netbios_name>(unknown)</netbios_name>

<mac_addr>(unknown)</mac_addr>

<dns_name>(unknown)</dns_name>

<os_name>(unknown)</os_name>

<num_ports>2</num_ports>

<num_lo>0</num_lo>

<num_med>0</num_med>

<num_hi>0</num_hi>

<ReportItem>

<port>http (80/tcp)</port>

<severity>0</severity>

<pluginID>0</pluginID>

<pluginName></pluginName>

<data>PORT</data>

</ReportItem>

<ReportItem>

<port>telnet (23/tcp)</port>

<severity>0</severity>

<pluginID>0</pluginID>

<pluginName></pluginName>

<data>PORT</data>

</ReportItem>

<ReportItem>

<port>http (80/tcp)</port>

<severity>0</severity>

<pluginID>0</pluginID>

<pluginName></pluginName>

<data>PORT</data>

</ReportItem>

<ReportItem>

<port>telnet (23/tcp)</port>

<severity>0</severity>

<pluginID>0</pluginID>

<pluginName></pluginName>

<data>PORT</data>

</ReportItem>

</ReportHost>

<some-xml3>

</some-xml3>

</some-xml1>

 

There are <reporthost> tags for one host and within that tag are <reportitem> tags for every item on that host.

Now I need a way to extract hostnames from every <reporthost> and associate all the <pluginname> with that particular host.

Any help will be appreciated.

 

Thanks in advance

:D

 

Link to comment
https://forums.phpfreaks.com/topic/210327-help-with-parsing-xml/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.