if($xmlobj = simplexml_load_string(file_get_contents($xml_feed))) { $result = $xmlobj->xpath("TrafficMeta"); } PHP: The above code returns the desired result and when viewed with print_r it shows this, which is what I want to get (sessionId): Array ( [0] => SimpleXMLElement Object ( [sessionId] => tbfm1t45xplzrongbtbdyfa5 ) ) PHP: How can I make this sessionId into a string?
Try $id = $result['sessionId']; PHP: If it doesn't work print the output of this var_dump here. var_dump($result); PHP:
You might need to do something like this: $id = $result->sessionId; Since this is an object not an array.