0

Hi,
I have a doubt as if i have a "xml format" text message in my email body then how can i cobert it into an array so that i can fetch each node form it
for example:
my email body containts xml format:

<?xml version="1.0" ?>
<candidate>
<name>Superduper automation</name>
<email>yogesh@gmail.com</email>
<explevel>1</explevel>
<skillset>super automation</skillset>
<track>Tester</track>
</candidate>

like this.
now I want to fetch <name> , <email> etc values seperatly. so how can i do that?
(dont forget that xml code is in my email body part!

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Priti_P
0

Sorry to both of you, i forgot to tell you that am a new/fresh user in PHP.
buts its not working properly and its taking as empty input.
@ adam.adaski: soory, but the user u have mentioned here is (I think) using already created .xml file.
but in my condition it will not work since Here xml code is in body only. it is not in any file (or attachment)
for this even i tried to fetch a body part by using

imap_fetchbody($inbox,$email_number,1.2)

function. and created file having extension as '.xml' (suppose its 'simple.xml') and saved into it.
but it is giving u as in HTML format. like-

<?xml version="1.0" ?><br><candidate><br>    <name>Superduper automation</name><br>    <email><a href="mailto:yogesh@gmail.com" target="_blank">yogesh@gmail.com</a></email><br>  <explevel>1-2</explevel><br>    <skillset>super automation</skillset><br>    <track>Tester</track><br></candidate>

So is there any function which does save simple.xml file exact as

<?xml version="1.0" ?>
    <candidate>
    <name>Superduper automation</name>
    <email>yogesh@gmail.com</email>
    <explevel>1</explevel>
    <skillset>super automation</skillset>
    <track>Tester</track>
    </candidate>

but not in html format as i have written above, so that i can use same function in other programs also.
please correct me if am wrong .
and drag me out from this problem.
or suggest me with other solution fron which i will be able to fetch 'candidate', 'name' , 'email' etc and able to form a database according to these attributes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.