SSL certificate to http-client

asareStephen2026

问题描述

How do i set an SSL certificate to http-client

228 1 0
1个回答

walkor
$http = new \Workerman\Http\Client([
    'context' => [
        'ssl' => [
            'local_cert'        => '/your/path/to/pemfile',
            'passphrase'        => 'your_pem_passphrase',
            'verify_peer' => true,
            'verify_peer_name' => true,
        ],
    ]]);
$http->get('https://example.com/', function ($response) {
    echo $response->getBody();
});
×
🔝