In PHP how do you get the simple text of an XML attribute only XML? -


this question has answer here:

i have xml that's coming curl post that's returning:

$output=<?xml version="1.0" encoding="utf-8" standalone="yes"?> <mtmessagersp carrier="102" messageid="769f2e4f-56da-4865-988a-a9199c387a48"/> 

i'm returning xml via:

return simplexml_load_string($output); 

$result catching return , it's coming as:

$result = {    "@attributes" :  {      carrier : "102",     messageid : "8d691cbe-d188-42b1-9041-387666d39c6a"   } 

how can drill down messageid plane text? when use this:

$result['messageid'] 

i get:

{    "0" : "bf629ae9-c86a-486a-bfb0-704e16448ddf" } 

but want:

bf629ae9-c86a-486a-bfb0-704e16448ddf 

figured out in post:

$msgid = (string) $result['messageid']; 

you have cast simplexml object string. post: get value simplexmlelement object


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -