Jump to content

display linkedin details in my text fields using php


DamForums

Recommended Posts

i have managed to connect with Linkedin APi, so i can get the users details using below code.



$response = $OBJ_linkedin->profile('~:(id,first-name,last-name,picture-url,email-address,phone-numbers)');
if($response['success'] === TRUE) {
$response['linkedin'] = new SimpleXMLElement($response['linkedin']); 

after that i need to display the retrieved details into text fields like this.



<table border="1">
<tr>
<td>Name</td>
<td><?php echo $response['linkedin']->id; ?></td>
</tr>


<tr>
<td>first Name</td>
<td><?php echo $response['linkedin']->first-name; ?></td>
</tr>


<tr>
<td>Email</td>
<td><?php echo $response['linkedin']->email-address; ?></td>
</tr>


</table> 

Id is displaying correctly, but other details are not showing. can anyone help on this. thanks in advance


Depending on what $response['linkedin'] looks like, maybe this:

$li = (array)$response['linkedin'];
//then
echo $li['first-name'];

But to use it as an object (PHP vars cannot contain hyphens):

echo $response['linkedin']->{'first-name'};

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.