Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6048429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:27:44+00:00 2026-05-23T07:27:44+00:00

I really don’t understand how to use SimpleXML in PHP. Here is an exemple

  • 0

I really don’t understand how to use SimpleXML in PHP.

Here is an exemple of my XML file:

<?xml version="1.0" encoding="UTF-8" ?>
<eventlog version="1.1">

<event source="Firewall" timeStamp="1308433939" type="0" deleted="0" bodyLength="218">
<subject>Network access detected</subject>
<action>Allowed</action>
<message>The program c:\xampp\apache\bin\httpd.exe attempted to connect to the Internet. The program used the protocol TCP on port 80.</message>
</event>

</eventlog>

I need to retrieve this:
Source, Timestamp, Subject, Action, Message

I just don’t get it. Can someone please help me with this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:27:44+00:00Added an answer on May 23, 2026 at 7:27 am

    This code should work:

    $xml = new SimpleXMLElement($xmlString);
    $source = $xml->event->attributes()->source;
    $timestamp = $xml->event->attributes()->timestamp;
    $subject = $xml->event->subject;
    $action = $xml->event->action;
    $message = $xml->event->message;
    

    … where $xmlString is the string of the xml file.

    Read up on how to use simpleXML here.

    Hope this helped and good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really don't understand the fascination with XHTML strict. Inline JavaScript typically requires a
I've just installed Resharper, and I really don't know how to use it correctly.
This question is coded in pseudo-PHP, but I really don't mind what language I
I really don't understand why this function doesn't work: function GetNomRepertoireTemporaire:WideString; var PathLocal :
I really don't understand how a class like HttpContext.Current is visible (for the single
I really don't like the VS2008 Start Page. I don't need the RSS reader,
I really don't know how to describe it, but if you understood it and
I am re-designing an application for a ASP.NET CMS that I really don't like.
I have the following markup for buttons (can be changed, but I really don't
I don't really get lambda expressions. While they've been around since the days of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.