I've found that lots of people are posting in their forum for the code samples. And only very few obscure code examples are available. I've found phplinkedin script but that is just too bulky for a simple oAuth dance So here are two files to perform 3 step oAuth Dance for both twitter and linkedin.
The code (either cut-and-paste-able in the post or downloadable here) gives you three files - a configuration and one for the Twitter API and the other for the LinkedIn API. They both rely on the oAuth extension in the PECL library.