卷曲不适用于https

I am trying to use https href in curl (URL is https://), but always throw error: 302 Unable to connect to server. Please come back later. Where can be problem?

                $ch = curl_init();
                $curlConfig = array(
                    CURLOPT_URL => $URL,
                    CURLOPT_POST => true,
                    CURLOPT_RETURNTRANSFER => true,
                    CURLOPT_SSL_VERIFYPEER => false,
                    CURLOPT_SSL_VERIFYHOST => false,
                    CURLOPT_POSTFIELDS => array(
                        ... data ...
                    )
                );
                curl_setopt_array($ch, $curlConfig);
                $result = curl_exec($ch);
                if (!$result) {
                    $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                    curl_close($ch); // make sure we closeany current curl sessions 
                    die($http_code . ' Unable to connect to server. Please come back later.');
                }
                echo $result;
                curl_close($ch);

Error 302 is a redirection error. The additional "Unable to connect to server. Please come back later." is a wrong statement coming from your own code.

To make php-curl follow redirections, add

CURLOPT_FOLLOWLOCATION => true,

to the curlConfig array.

To set curl option like

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

set curl option as

  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);