PayPal\Core\PayPalHttpConfig::setSSLCert PHP Method

setSSLCert() public method

Set ssl parameters for certificate based client authentication
public setSSLCert ( $certPath, null $passPhrase = null )
$certPath
$passPhrase null
    public function setSSLCert($certPath, $passPhrase = null)
    {
        $this->curlOptions[CURLOPT_SSLCERT] = realpath($certPath);
        if (isset($passPhrase) && trim($passPhrase) != "") {
            $this->curlOptions[CURLOPT_SSLCERTPASSWD] = $passPhrase;
        }
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function testSSLOpts()
 {
     $sslCert = '../cacert.pem';
     $sslPass = '******';
     $o = new PayPalHttpConfig();
     $o->setSSLCert($sslCert, $sslPass);
     $curlOpts = $o->getCurlOptions();
     $this->assertArrayHasKey(CURLOPT_SSLCERT, $curlOpts);
     $this->assertEquals($sslPass, $curlOpts[CURLOPT_SSLCERTPASSWD]);
 }