Jeff Long
Jeff Long

Reputation: 69

Getting an element out of an XML Object With PHP

I am completely stuck on this issue so your help is greatly appreciated!

I simply need to pull the ValidationCode out of this existing XML object.

Here's is what I get when I do:

print_r($response);

TheResponse Object ( [ResponseText] => xxxxxxxxx [ResponseXml] => SimpleXMLElement Object ( [ValidationRequest] => SimpleXMLElement Object ( [AccountSid] => xxxxxxxx [PhoneNumber] => +15555555555 [FriendlyName] => SimpleXMLElement Object ( ) [ValidationCode] => 601532 ) ) [HttpStatus] => 200 [Url] => https://api.dddddd.com//2010-04-01/Accounts/xxxxxx/OutgoingCallerIds [QueryString] => [IsError] => [ErrorMessage] => )

How in the WORLD do I access that Validation Code using php?

Thank you for your assistance!

Upvotes: 0

Views: 58

Answers (2)

Mert Emir
Mert Emir

Reputation: 691

$ValidationCode=$response->ResponseXml->ValidationRequest->ValidationCode;

Upvotes: 1

user142162
user142162

Reputation:

$code = $response->ResponseXml->ValidationRequest->ValidationCode;

Upvotes: 1

Related Questions