How to access element of array SimpleXMLElement Object in php
Well I am trying to solve this problem as I am linked with linkedin and am trying to access the following xml object in php to print and only access names.
XML output:
SimpleXMLElement Object(
[id] => MFNqBCcdLOLO
[first-name] => James
[last-name] => Bond
[picture-url] => https://media.licdn.com/mpr/mprx/0_ljsdflkdsjfkjflkds
)
and my printable PHP code above:
$response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url)');
print_r($response);
if($response['success'] === TRUE) {
$response['data'] = new SimpleXMLElement($response['linkedin']);
//insert data...to linkedin_userprofile table...
$linkedin = new Linkedinprofile();
echo "<pre>" . print_r($response['data'], TRUE) . "</pre>";
Now if anyone can help:
$response['data']
Now print the output, how can I access the $response['data'][first-name]
.
Please guys if anyone knows how to do this then it would be great if you would like to know how to access. I have also searched the web several times but did not find an answer. Thanks in an advanced state. :)
+3
source to share
No one has answered this question yet
See similar questions:
or similar: