Hi guys,

I've got the following code which has been written from scratch: http://pastebin.com/y7EFJLjf

PHP Code:
<?php

//priv key/secret
$apikey 'myapikey';
$secret 'myapisecret';

//get random nonce.
$nonce rand(1,999999999);

//init curl
$ch curl_init();

//set the auth url.
curl_setopt($chCURLOPT_URL'http://www.linkedin.com/uas/oauth/authorize');

//posting not get
curl_setopt($chCURLOPT_POSTtrue);

//params
$params = array(
            
'oauth_callback' => 'http://tools.dev.co.uk/linkedin/',
            
'oauth_consumer_key' => $apikey,
            
'oauth_nonce' => $nonce,
            
'oauth_signature_method'=>'HMAC-SHA1',
            
'oauth_timestamp' => time()
        );

//sort the params alphabetically by key
ksort($params);

//now bring the array together and urlencode as a string to be passed in signature.
$paramString '';
foreach (
$params as $key => $param)
{
    
$paramString .= (empty($paramString)) ? $key .'='$param '&' $key .'='$param;
}
$paramString urlencode($paramString);

//get the encoded secret code
$shaSecret hash_hmac('SHA1'$secret.'&'$apikeytrue);

//this gets all the params into 1 array to be posted, it also 
$full_parameters array_merge(array('oauth_signature' => 'POST&'.urlencode('https://www.linkedin.com/uas/oauth/authorize').'&'.$paramString'oauth_consumer_secret' => $shaSecret), $params);
ksort($full_parameters);

//set the curl options, return header info, postfields etc
curl_setopt($chCURLOPT_POSTFIELDS$full_parameters);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_HEADERtrue);

//get the content.
$thereturnvalue curl_exec($ch);

//close curl conn
curl_close($ch);

//output content.
echo $thereturnvalue;
I've been trying to follow documentation to just get the request token so I can then move onto authentication. I'm 99% sure everything is correct but the Linkedin just gives me an error 400 meaning they're incorrect.

As well as the URL "oauth/authorize" I've also tried "oauth/requestToken" which gives the same result. (The URLs on their docs are 404's so it's hard to find out what I should be using definitively)