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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.