繁体   English   中英

Linkedin PHP登录API调用

[英]Linkedin PHP Login API Call

我正在使用在Github上找到的类(Happyr \\ Linkedin)连接到Linkedin API并创建登录名。 它运行良好,没有任何问题,直到不再运行为止,但完全没有进行任何更改。

这是我的通话代码:

$linkedIn=new Happyr\LinkedIn\LinkedIn('apikey', 'apisecret');

在session_start();

if ($linkedIn->isAuthenticated() && isset($_GET['code'])) {

    $user=$linkedIn->get('v1/people/~:(firstName,lastName,id,picture-url)');
    if ($user){
      $_user = User::where('linkedin_id', $user['id'])->first();

      if (!$_user) {
        //create user and login
        header("Location: search.php");
        exit();
      } else {
        //login user
        header("Location: search.php");
        exit();
      }
    }

我收到的是供应商软件包中的一个例外:

Fatal error: Uncaught Http\Client\Exception\NetworkException: Could not resolve host: www.linkedin.com in /var/www/html/vendor/php-http/curl-client/src/Client.php:134 Stack trace: 
#0 /var/www/html/vendor/happyr/linkedin-api-client/src/Http/RequestManager.php(37): Http\Client\Curl\Client->sendRequest(Object(GuzzleHttp\Psr7\Request))
#1 /var/www/html/vendor/happyr/linkedin-api-client/src/Authenticator.php(124): Happyr\LinkedIn\Http\RequestManager->sendRequest('POST', 'https://www.lin...', Array, 'grant_type=auth...')
#2 /var/www/html/vendor/happyr/linkedin-api-client/src/Authenticator.php(76): Happyr\LinkedIn\Authenticator->getAccessTokenFromCode(Object(Happyr\LinkedIn\Http\UrlGenerator), 'AQTWSqlSdfv3Fy_...')
#3 /var/www/html/vendor/happyr/linkedin-api-client/src/LinkedIn.php(293): Happyr\LinkedIn\Authenticator->fetchNewAccessToken(Object(Happyr\LinkedIn\Http\UrlGenerator))
#4 /var/www/html/vendor/happyr/linkedin-api-client/src/LinkedIn.php(95): Happyr\LinkedIn\LinkedIn->getAccessToken()
#5 /var/www/html/index.php(9): Happ in /var/www/html/vendor/happyr/linkedin-api-client/src/Authenticator.php on line 128

关于如何解决这个问题的任何想法?

更新您的composer.lock文件,然后重试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM