I have been trying to gain access to a couple of APIs from two different parties using cURL
but have been experiencing a consistent issue. When I submit a request to either party I receive the following error:
SSL certificate problem: self signed certificate in certificate chain
I am attempting to reach these APIs from my localhost which is currently WAMP.
Here is how I am attempting to gain access:
$ch = curl_init($target_url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if(curl_error($ch)) {
var_dump(curl_error($ch));
}
curl_close($ch);
var_dump($response);
I am confused as to why I am recieving an error because I can use the following code to access the APIs using file_get_contents()
$opts = [
"http" => [
"header" => implode("\r\n", $headers)
],
'ssl' => [
'verify_peer' => true,
"verify_peer_name" => true
]
];
$context = stream_context_create($opts);
$response = file_get_contents($target_url, NULL, $context);
var_dump($response);
Edit: These requests contain sensitive information so TLS/SSL is a must.
Edit: $target_url = 'https://*3rd Party API*/target';
Edit: there is no proxy