D
D
Dmitry Cherednichenko2014-12-10 15:12:58
PHP
Dmitry Cherednichenko, 2014-12-10 15:12:58

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);

With this request, I get
Protocol tls not supported or disabled in libcurl

Here is an example of accessing TLS, how to make friends with cURL? stackoverflow.com/questions/3153206/how-to-make-tl...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2014-12-10
@SilenceOfWinter

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 question

Ask a Question

731 491 924 answers to any question