Home » Php » Peer certificate cannot be authenticated with known CA certificates using PHP OAuth extension

Peer certificate cannot be authenticated with known CA certificates using PHP OAuth extension

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m using PHP OAuth extension to make a call to the Tradeking API. When I make the exact call as in here, https://developers.tradeking.com/documentation/php

I’m getting the exception

Exception caught! Response: making the request failed (Peer certificate cannot be authenticated with known CA certificates)

Why this is happening and how can I resolve this?

How to&Answers:

The OAuth extension uses curl to make the request. By default CURL will generally verify the SSL certificate to see if its valid an issued by an accepted CA. To do this, curl uses a bundled set of CA certificates.

You can either disable the SSL checks ($oauth->disableSSLChecks()). Or ensure that you have a current version of curl. More information on curl certification verification.

Answer:

The right solution is checking the server TIME. If it is wrong SSL doesn’t work fine.