Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8485995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:48:38+00:00 2026-06-10T20:48:38+00:00

I want to get the profile info after getting the token <?php session_start ();

  • 0

I want to get the profile info after getting the token

<?php

    session_start ();

    if (!$_SESSION['linkedin_access_token'])
    {
        echo 'Grant access first';
        exit ();
    }

    ## step 0
    define ('LINKEDIN_KEY', 'xxxxxx');
    define ('LINKEDIN_SECRET', 'xxxxxxx');

    function urlencode_oauth ($str)
    {
        return str_replace ('+', ' ', str_replace ('%7E', '~', rawurlencode ($str)));
    }

    $links = array (
        'request_token' => 'https://api.linkedin.com/uas/oauth/requestToken',
        'authorize' => 'https://www.linkedin.com/uas/oauth/authorize',
        'access_token' => 'https://api.linkedin.com/uas/oauth/accessToken',
    );


    ## step 2
    $params = array (
        'oauth_consumer_key' => LINKEDIN_KEY,
        'oauth_nonce' => sha1 (microtime ()),
        'oauth_signature_method' => 'HMAC-SHA1',
        'oauth_timestamp' => time (),
        'oauth_token' => $_SESSION ['linkedin_access_token'],
        'oauth_version' => '1.0'
    );

    ## step 3
    // sort parameters according to ascending order of key
    // sort parameters according to ascending order of key
    ksort ($params);

    // prepare URL-encoded query string
    $q = array ();
    foreach ($params as $key => $value)
    {
        $q [] = urlencode_oauth ($key) . '=' . urlencode_oauth ($value);
    }
    $q = implode ('&', $q);

    // generate the base string for signature
    $parts = array (
        'POST',
        urlencode_oauth ('https://api.linkedin.com/v1/people/~'),
        urlencode_oauth ($q)
    );
    $base_string = implode ('&', $parts);

    ## step 4
    $key = urlencode_oauth (LINKEDIN_SECRET) . '&' . urlencode_oauth ($_SESSION ['linkedin_access_token_secret']);
    $signature = base64_encode (hash_hmac ('sha1', $base_string, $key, true));

    ## step 5
    $params ['oauth_signature'] = $signature;
    $str = array ();
    foreach ($params as $key => $value)
    {
        $str [] = $key . '="' . urlencode_oauth ($value) . '"';
    }
    $str = implode(', ', $str);
    $headers = array (
        'POST /v1/people/~ HTTP/1.1',
        'Host: api.linkedin.com',
        'Authorization: OAuth ' . $str,
        'Content-Type: text/xml;charset=UTF-8',
        'Content-Length: 0',
        'Connection: close'
    );

    ## step 6
    $fp = fsockopen ("ssl://api.linkedin.com", 443, $errno, $errstr, 30);
    if (!$fp)
    {
        echo 'Unable to connect to LinkedIn';
        exit();
    }
    $out = implode ("\r\n", $headers) . "\r\n\r\n";
    fputs ($fp, $out);

    // getting LinkedIn server response
    $res = '';
    while (!feof ($fp)) $res .= fgets ($fp, 4096);
    fclose ($fp);

    echo '<pre>';
    echo $res . "\n\n";
    echo $_SESSION ['linkedin_access_token'] . "\n" . $_SESSION ['linkedin_access_token_secret'];

 ?>

What’s wrong with it? it shows me

HTTP/1.1 405 Method Not Allowed
Server: Apache-Coyote/1.1
x-li-request-id: H8M76QXW5O
Date: Tue, 04 Sep 2012 12:09:21 GMT
Vary: *
x-li-format: xml
Content-Type: text/xml;charset=UTF-8
Content-Length: 262

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <status>405</status>
  <timestamp>1346760561727</timestamp>
  <request-id>H8M76QXW5O</request-id>
  <error-code>0</error-code>
  <message>Unsupported POST target {/v1/people/~}</message>
</error>


xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T20:48:40+00:00Added an answer on June 10, 2026 at 8:48 pm

    As the documentation indicates, the Profile API does not support the POST method. Try using GET instead to retrieve profile data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a chrome extension, and want to be able to get a profile
I want get the user profile large or normal picture from facebook. Now I
I want get the time used for a case so I can create an
I want get all of the Geom objects that are related to a certain
I want get as much as possible from Redis + Hiredis + libevent. I'm
What I want: get a xml from the AppData to use What I code
Basically I want get data I already have accessed from javascript and passing it
I just want get a 2 dimension array of List in c#. In my
i want query a file xml with linq, i want get all descendat of
I want to get list of tables in a given database and a given

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.