php CURL CA Error

178 views Asked by At

Hi apologizes if this is answered, but i could not find it

I have setup a code to test on the openfigi, here is the sample

$data = array('idType' => 'ID_WERTPAPIER', 'idValue' => '851399', 'exchCode' => 'US');                                                                    
$data_string = json_encode($data);                                                                                   

$ch = curl_init('https://api.openfigi.com/v1/mapping');                                                                      

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);                                                                  
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                                      
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json',                                                                                
                                            'Accept: application/json',
                                            'X-OPENFIGI-APIKEY: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
                                            )  );                                                                                                                   


$result = curl_exec($ch);
echo $result; 

if (curl_errno($ch)) {
    print "Error: " . curl_error($ch);
} else {
    var_dump($result);
    curl_close($ch);
}

curl_close($ch);

but when i try to use it i get the error

Error: error setting certificate verify locations: CAfile: C:\xampp\apache\conf\extra\cacert.pem CApath: none

I have read all the info on the cacert.pm, downloaded it put it where suggested

added it to the php.ini file

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an absolute path.
curl.cainfo ="C:\xampp\apache\conf\extra\cacert.pem"

changed the backslashes to forward slashes

and yet no luck

would appreciate the help

thanks

0

There are 0 answers