Skip to content

Failed to access a TLS server #54

Closed
@guss77

Description

@guss77

Trying to access TLS servers, I keep getting errors. For example when trying to access https://www.google.com , I get this:

An error occurred in the underlying stream:
Unable to complete SSL/TLS handshake:
stream_socket_enable_crypto():
Peer certificate CN=`www.google.com' did not match expected CN=`74.125.140.106'

My code is:

        $request = $this->client->request('GET', 'https://www.google.com', [ ]);
        $request->on('error', function ($err) use ($callback) { $callback($err, NULL); });
        $request->on('response', function ($response) {
            $response->on('data', function ($data, $response) {
                echo "Got response data";
                var_dump([$data, $response]);
            });
        });
        $request->end();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions