intazaar
asked on
PHP and XML
hi,
how do i use PHP to get information out of XML files, i want to take each section and put it into a php variable for example
$to = "james";
$from = "glen";
$heading = "reminder";
$body = "hello";
the information is taken from:
<email>
<to>james</to>
<from>glen</from>
<heading>Reminder</heading >
<body>hello</body>
</email>
thanks
how do i use PHP to get information out of XML files, i want to take each section and put it into a php variable for example
$to = "james";
$from = "glen";
$heading = "reminder";
$body = "hello";
the information is taken from:
<email>
<to>james</to>
<from>glen</from>
<heading>Reminder</heading
<body>hello</body>
</email>
thanks
ASKER
will it work for php 4?
For php4, try to use DOM XML http://www.php.net/manual/en/ref.domxml.php
ASKER
but then what would the code be?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
$document = new DOMDocument();
$document->load('./yourfil
$el=$document->getElements
$to =$el->item(0)->getElements
$from =$el->item(0)->getElements
$heading = $el->item(0)->getElementsB
$body = $el->item(0)->getElementsB
look at this: http://www.php.net/dom