I am working with the following xml
<?xml version="1.0" encoding="UTF-8"?>
<ns2:worldmate-parsing-result xmlns:ns2="http://www.worldmate.com/schemas/worldmate-api-v1.xsd" request-id="100793160" received="2014-12-27T16:34:42.000Z">
<status>SUCCESS</status>
<error-msg>An itinerary confirmation e-mail was parsed successfully</error-msg>
<headers>
<header value="multipart/alternative; boundary="Apple-Mail=_62E5BF7A-C482-4FE0-8F43-15613E46D5FD"" name="Content-type" />
<header value="<xxxxx@me.com>" name="Return-Path" />
<header value="rule=notspam policy=default score=0 spamscore=0 suspectscore=3 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1412080000 definitions=main-1412270180" name="X-Proofpoint-Spam-Details" />
</headers>
<end-user-emails>
<user email="yyyyy@me.com" />
</end-user-emails>
....
</ns2:worldmate-parsing-result>
I am trying to access the following data within the xml:
xxxxx@me.com
yyyyy@me.com
I am trying to do access the second email address using the following code.
$endus='end-user-emails';
$endUserEmails=$xml->$endus->attributes()->{'user'};
echo $endUserEmails;
Not sure why but it is forcing me to use a variable name, and if I use dashes I get errors.