SSL with Guzzle

1,040 views
Skip to first unread message

Александр Бармалеев

unread,
Aug 28, 2013, 3:43:08 AM8/28/13
to guz...@googlegroups.com
Good time!

I need connect to https server
Admin send me the certificate file: certificat.cer

As I known, I need certificat,pem
Make *.pem
openssl x509 -outform pem -in certificate.cer -out certificate.pem

Now write php-code:

<?php
include_once('vendor/autoload.php');
$params=array();
use \Guzzle\Http\Client;

$url='https://very.frendly.server.com';
$client = new Client($url,
    array(
        'Content-Type' => 'application/json',
        'curl.options' => array(
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_SSLCERT => 'certificate.pem'
        ),
        'ssl.certificate_authority' => 'system',
    )
);
$request = $client->post(
    $path,
    array(
        'Content-Type' => 'application/json'
    ),
    json_encode($params)
);

...and get:
[curl] 58: unable to set private key file

Where error? In code? In certificate? In DNA?

Michael

unread,
Sep 20, 2013, 4:25:24 PM9/20/13
to guz...@googlegroups.com
I think you need to specify the certificate using an absolute path.
Reply all
Reply to author
Forward
0 new messages