I have setup a custom Magento Rest Api at the endpoint: "https://domain-name.de/rest/V1/wawi". This Api just returns a simple json string. Have tested my Api with Postman application -> works fine.
The problem occurs, when I test it in PHP script:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://domain-name.de/rest/V1/wawi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"p\":\"test\"}",
CURLOPT_HTTPHEADER => array(
"cache-control: no-cache",
"content-type: application/json",
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
RESULT:
cURL Error #:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Any ideas on how to solve this issue ?
EDIT Just checked my magento server is using "OpenSSL 1.0.1e-fips 11 Feb 2013 openssl version number: 268439647" and my client is using "OpenSSL 1.0.1k 8 Jan 2015 openssl version number: 268439743"
2 Answers 2
please add CURLOPT_SSLVERSION =>3
-
Thx for the reply. Added and got new error message: cURL Error #:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version numberBlackpanther0001– Blackpanther00012018年01月10日 13:02:17 +00:00Commented Jan 10, 2018 at 13:02
-
Tried also with 2, message: cURL Error #:OpenSSL was built without SSLv2 supportBlackpanther0001– Blackpanther00012018年01月10日 13:03:28 +00:00Commented Jan 10, 2018 at 13:03
-
magento ver 1.9.2.3,I am work with REST API in POSTMAN, i have all oAuth 1.0 details like Consumer Key,Consumer Secret,Access Token,Token Secret. Now i moved to oAuth 2.0, how can i get my all oAuth 2.0 details? @Nalin Savaliyazus– zus2018年10月30日 06:34:51 +00:00Commented Oct 30, 2018 at 6:34
I don't see any reason for using the following lines:
CURLOPT_ENCODING => "",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_ENCODING => "",
Try removing all these lines, or, if you prefer, test removing one by one.
-
Let me know if this solves you issue. If negative I will take a deeper analysis.Gustavo Ulyssea– Gustavo Ulyssea2022年01月02日 21:46:10 +00:00Commented Jan 2, 2022 at 21:46