Curl_exec returns false after updating a PHP form from 5.4 to 5.5

I upgraded php version from 5.4 to 5.5. After updating php, the curl_exec function will start to return false . Are there any changes to curl options in php 5.5? I can not find anything in the documentation.

        $ch = curl_init();
        curl_setopt( $ch, CURLOPT_POST, 1 ); 
        curl_setopt( $ch, CURLOPT_HEADER, 0 ); 
        curl_setopt( $ch, CURLOPT_URL, self::URL ); 
        curl_setopt( $ch, CURLOPT_POSTFIELDS, $postData );
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 );  
        curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_TIMEOUT, 90 );
        $data = curl_exec( $ch );

PHP Version: 5.5.14-2

Note: I get this error in Vagrant Box

+4
source share
1 answer

I recently went through a similar php upgrade, also on the firewall, and the code snippet above works fine when I try it here.

, , , , ? self::URL $postData - , ?

, , , curl_exec, curl_getinfo, curl_errno curl_error

$ch = curl_init();
...
$data = curl_exec( $ch );
if (!$data) {
    echo curl_getinfo( $ch ) . "\n";
    echo curl_errno( $ch ) . "\n";
    echo curl_error( $ch ) . "\n";
}

, .

+1

Source: https://habr.com/ru/post/1547742/


All Articles