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