SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation display linkedin details in my text fields using php

    i have managed to connect with Linkedin APi, so i can get the users details using below code.
    PHP 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.
    HTML Code:
    <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

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,447
    Mentioned
    45 Post(s)
    Tagged
    13 Thread(s)
    Hi DForums, welcome to the forum!

    Have you tried outputting the XML to screen to see what you're actually getting returned?

    This should display the results in a readable way:
    PHP Code:
    $xml = new SimpleXMLElement($response['linkedin']);
    $dom dom_import_simplexml($xml)->ownerDocument;
    $dom->formatOutput true;
    echo 
    $dom->saveXML(); 


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •