Error consuming api with Curl php -> 'Failed to connect to demo.d4sign.com.br port 443: Timed out'

Asked

Viewed 40 times

1

When I consume an api with Curl php the following error appears: Failed to connect to demo.d4sign.com.br port 443: Timed out.

Curl’s code:

<?php       
                $tknAPI;
                $cryptKey;
                $curl = curl_init();
            
                curl_setopt($curl, CURLOPT_URL, 'https://demo.d4sign.com.br/api/v1/list?tokenAPI=' . $tknAPI . '&cryptKey=' . $cryptKey);
                //curl_setopt($curl, CURLOPT_HEADER, TRUE);
                curl_setopt($curl, CURLOPT_TIMEOUT, 30);
                curl_setopt($curl, CURLOPT_HTTPHEADER, ['Accept: application/json', 'Content-Type: application/json']);
                curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

                echo $result = curl_exec($curl);
                echo $err = curl_error($curl);
                    
            ?>
  • 1

    If you are consuming an endpoint on port 443, are you using ssl, do you have the certificate installed? tried to pass the certificate as a parameter to Curl, for example -cacert nome-do-certificado.crt?

  • even with ssl as parameter had not returned nor anything in echo but appeared with var_dump($result); Thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.