SSL certificate to http-client

asareStephen2026

问题描述

How do i set an SSL certificate to http-client

466 1 1
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();
});
×
🔝