Answer the question
In order to leave comments, you need to log in
How to access TLS protocol using cURL?
Hello!
Actually the code itself:
$data = '{"params": ["testing_true", "bb4238e7-8f6d-4b2e-9ea4-43791bfb72df"], "jsonrpc": "2.0", "method": "gate.check", "id": 27034}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "tls://site.com");
curl_setopt($ch, CURLOPT_PORT, 4928);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
));
$output = curl_exec($ch);
var_dump(curl_error($ch));
var_dump(curl_errno($ch));
echo($output) . PHP_EOL;
curl_close($ch);
Protocol tls not supported or disabled in libcurl
Answer the question
In order to leave comments, you need to log in
Is OpenSsl enabled? I have never tried tls, but its predecessor ssh can be used via sockets, for example
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question