【问题标题】:Infusionsoft OAuth callback SSL error PHPInfusionsoft OAuth 回调 SSL 错误 PHP
【发布时间】:2016-02-13 09:48:12
【问题描述】:

我的问题是这样的:

我已访问 developer.infusionsoft.com 以获取用于 Infusionsoft API 集成的 PHP-SDK 帮助程序库。 我通过作曲家安装了它。我有在作曲家完成后出现的供应商(文件夹)。

在教程中,供应商文件夹非常重要,所以我认为我走在正确的道路上

我使用 api 的代码是这样的

function loadInfusionsoft($callback) {
    $data = array();
    $data['status'] = "unsuccessfull";
    try {
        $infusionsoft = new \Infusionsoft\Infusionsoft(array(
            'clientId' => 'CLIENTID',
            'clientSecret' => 'SECRETKEY',
            'redirectUri' => $callback,
        ));
//        If the serialized token is available in the session storage, we tell the SDK
//        to use that token for subsequent requests.
        if (isset($_SESSION['token'])) {
            $infusionsoft->setToken(unserialize($_SESSION['token']));
        }

// If we are returning from Infusionsoft we need to exchange the code for an
// access token.
        if (isset($_GET['code']) and ! $infusionsoft->getToken()) {
            $infusionsoft->requestAccessToken($_GET['code']);
        }

        if ($infusionsoft->getToken()) {
// Save the serialized token to the current session for subsequent requests
            $_SESSION['token'] = serialize($infusionsoft->getToken());
        } else {
            $href = $infusionsoft->getAuthorizationUrl();
            $data['status'] = "successfull";
            $data["href"] = $href;
        }
    } catch (Exception $ex) {
        echo $ex->getMessage();
    }
    return $data;

请多多包涵,我是新手,所以我对正在发生的事情有一个模糊的线索。我在 infusionsoft 教程(git)上得到了这个代码。在理解事物的过程中,我遇到了一个错误。

cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

虽然我没有马上得到那个错误。据我了解,

  • 它将跳过所有 if 语句,并停留在 else 语句上。
  • 在 else 声明中,我将获得一个用于 infusionsoft 身份验证的 href 链接。很可能是 <a> 的 href 值。
  • 在页面上,单击该链接,将转到 infusionsoft 登录
  • 成功登录后,它将重定向到我的本地主机(因为回调变量),并带有 GET 变量(范围和代码)
  • 它将再次调用此函数。
  • 相信会进入if isset($_GET['code'])声明
  • 得到错误

    cURL 错误 60:SSL 证书问题:证书链中的自签名证书(请参阅http://curl.haxx.se/libcurl/c/libcurl-errors.html

  • 在我的研究中,我需要一个证书。

  • 在查看供应商文件夹(infusionsoft PHP SDK)时,我看到了 有一个cacert.pem 文件.. 在我的研究中,这是一个 证书文件

  • 我搜索了如何使用它,但我总是看到有关 crt 和 cert 文件。

我被卡住了。

下一步是什么?搜索了 infusionsoft 社区,但没有运气。

我相信这不是 infusionsoft 问题,而只是我的错误配置。 有人吗?

【问题讨论】:

  • 您的系统上是否有 cacert.pem 的副本?您可以从 curl.haxx.se (curl.haxx.se/ca/cacert.pem) 下载
  • @RamRaider 是的,我在 infusionsoft 的 PHP-SDK 上有它,但我不知道如何使用它。如我上面的陈述所示

标签: php apache api ssl-certificate infusionsoft


【解决方案1】:

只是想分享。经过几次尝试和错误。

这只是一个简单的错误(问题是我对此不太了解)

在 php.ini 文件中,像这样添加 cacert.pem 的路径。

curl.cainfo = "C:\path\to\cacert.pem"

注意 curl.cainfo 必须有绝对路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-06
    • 1970-01-01
    • 2021-07-01
    相关资源
    最近更新 更多