如何从头开始使 LinkedIn API 与 PHP 一起工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9411136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 06:45:11  来源:igfitidea点击:

How to Make LinkedIn API work with PHP from scratch

phpapilinkedin

提问by Ana Ban

this is my first time to work with API's in PHP, so please bear with me for asking a very basic question. All I need is to read my LinkedIn Summary from my LinkedIn profile and automatically show it on my website.

这是我第一次在 PHP 中使用 API,所以请耐心等待我提出一个非常基本的问题。我所需要的只是从我的 LinkedIn 个人资料中阅读我的 LinkedIn 摘要,并自动将其显示在我的网站上。

However the documentation on https://developer.linkedin.com/documents/libraries-and-toolsis quite overwhelming for me, and I don't know where to start. I was pointed to http://pecl.php.net/package/oauthand I even found http://code.google.com/p/simple-linkedinphp/downloads/detail?name=3.2.0.zip&can=2&q=but I just can't put all these together.

然而,https://developer.linkedin.com/documents/libraries-and-tools上的文档对我来说非常难,我不知道从哪里开始。我被指向http://pecl.php.net/package/oauth,我什至发现http://code.google.com/p/simple-linkedinphp/downloads/detail?name=3.2.0.zip&can=2&q =但我不能把所有这些放在一起。

The other materials I saw online assume that I know how to install oAuth on my server. Even the LinkedIn guide assumes that too.

我在网上看到的其他材料假设我知道如何在我的服务器上安装 oAuth。甚至 LinkedIn 指南也假设了这一点。

Could anybody give me some steps to follow to at least be able to make a call to display just the Summary from my LinkedIn profile, or maybe point me to a link that explains it for newbies? My website is hosted free on x10hosting.com.

任何人都可以给我一些要遵循的步骤,至少能够打电话显示我的 LinkedIn 个人资料中的摘要,或者给我指向一个为新手解释的链接?我的网站在 x10hosting.com 上免费托管。

Thank you so much.

非常感谢。

采纳答案by Kirsten Jones

There is a quick start guide (which has PHP code) here: https://developer.linkedin.com/docs/oauth2

这里有一个快速入门指南(其中包含 PHP 代码):https: //developer.linkedin.com/docs/oauth2

It does, however, require that you know how to install libraries on your server. This is a requirement for any OAuth library.

但是,它确实要求您知道如何在服务器上安装库。这是任何 OAuth 库的要求。

回答by Viral Solani

If you don't want to setup PECL Package in your server than you can go with oAuth and you can use LinkedIn rest API with it https://developer.linkedin.com/documents/linkedin-api-resource-map

如果您不想在服务器中设置 PECL 包,则可以使用 oAuth,并且可以使用 LinkedIn rest API https://developer.linkedin.com/documents/linkedin-api-resource-map

Now to call this API you can download this simple linkedin library https://github.com/mahmudahsan/Linkedin---Simple-integration-for-your-website. there is also demo given with it.

现在要调用这个 API,你可以下载这个简单的链接库https://github.com/mahmudahsan/Linkedin---Simple-integration-for-your-website。还有一个演示。

First you need to create Linkedin Application from here https://www.linkedin.com/secure/developer?newapp=to get linkedin_access and linkedin_secret.

首先,您需要从这里创建 Linkedin 应用程序https://www.linkedin.com/secure/developer?newapp=以获取linkedin_access 和linkedin_secret。

So when you have your linkedin_access and linkedin_secret just go to the demo.php of the library you have download and put there.

因此,当您拥有linkedin_access 和linkedin_secret 时,只需转到已下载的库的demo.php 并将其放在那里。

Now you can call the REST API and get thr result.

现在您可以调用 REST API 并获得结果。