phpapacheapissl-certificateinfusionsoft

Infusionsoft OAuth callback SSL error PHP


my problem is this:

Ive went to developer.infusionsoft.com to get the PHP-SDK helper library for Infusionsoft API integration. I installed it via composer. i have the vendor(folder)which, appears after composer finish.

over the tutorials, vendor folder is very significant so i think im on the right path of things

my code for using the api is this

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;

please bear with me, i am new to this, so i have a vague clue on what is happening. i got this code on the infusionsoft tutorial(git). and on the middle of understanding things, i got an error.

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

i didn't get that error right away though. on what i understand,

and im stucked.

whats the next step? searched infusionsoft community but no luck.

i believe its not an infusionsoft issue but a mere misconfiguration on my end. anyone?


Solution

  • just want to share. after few trials and errors.

    its just really a simple error (problem is i am not quite knowledgeable to this)

    on php.ini file, add the path to the cacert.pem like this.

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

    note that curl.cainfo must have an absolute path.