Error: CURL can’t connect: Protocol https not supported or disabled in libcurl

Asked

Viewed 698 times

-1

I am using the pagseguro API to make purchases on my site, it was working very well, normally. Today when I went to use again began to present this error:

Not Found

The requested URL /admin/usuario/
Fatal error: Uncaught exception 'Exception' with message 'CURL can't connect: Protocol https not supported or disabled in libcurl' in /home/onecom/public_html/admin/PagSeguroLibrary/utils/PagSeguroHttpConnection.class.php:120Stack trace: was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

My configured Token and email are correct, but I don’t know what it can be. The code I’m using:

<?php 

require_once "../PagSeguroLibrary/PagSeguroLibrary.php";

class CreatePaymentRequest
{

    public static function main()
    {

        $paymentRequest = new PagSeguroPaymentRequest();

        $paymentRequest->setCurrency("BRL");

        $paymentRequest->addItem('0001', 'notebook', 2, 430.00);

        $paymentRequest->addItem('0002', 'notebook 2', 2, 560.00);


        $paymentRequest->setReference("REF123");

        $paymentRequest->setRedirectUrl("http://www.lojamodelo.com.br");


        try {

            $credentials = new PagSeguroAccountCredentials("[email protected]","MEU-TOKEN");

            $url = $paymentRequest->register($credentials);

            self::printPaymentUrl($url);
        } catch (PagSeguroServiceException $e) {
            die($e->getMessage());
        }
    }

    public static function printPaymentUrl($url)
    {
        if ($url) {
            echo "<h2>Criando requisi&ccedil;&atilde;o de pagamento</h2>";
            echo "<p>URL do pagamento: <strong>$url</strong></p>";
            echo "<p><a title=\"URL do pagamento\" href=\"$url\">Ir para URL do pagamento.</a></p>";
        }
    }
}

CreatePaymentRequest::main();
?>

1 answer

1


The error message says that the HTTPS protocol is not supported or disabled in your server’s Curl library. You have to have this library installed and active.

If it still doesn’t work you should check with your hosting company if it is possible to enable or change host, because Pagseguro only works with secure Urls (https).

  • By phpinfo() for me to check if https is enabled? Because on the localhost I put a phpinfo() and on Registered PHP Streams appeared HTTPS. Now the web server does not appear

  • Look in PHP info on your server for something about "Curl support" if you think is why it is installed.

  • just access your php.ini file that usually sits inside your server’s php folder (yes, you need access to that file) and look for that line: ;Extension=php_curl.dll Now remove the semicolon(;) from the beginning of the line, restart your server and check that it is ok.

Browser other questions tagged

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