Od 2h męczę się z tym, odkąd strona którą parsuję przeszła na https. Jak to zrobić? Poniższy skrypt który znalazłem i lekko zmodyfikowałem nie działa.
$url = 'https://.......';
// In this example we are referring to a page that handles xml
$headers = array( "Content-Type: text/html",);
// Initialise Curl
$curl = curl_init();
if ($curl === false)
{
throw new Exception(' cURL init failed');
}
// Configure curl for website
curl_setopt($curl, CURLOPT_URL, $url);
// Set up to view correct page type
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
// Turn on SSL certificate verfication
curl_setopt($curl, CURLOPT_CAPATH, "inc/cacert.pem"); //pobrany plik z różnymi CA
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, TRUE);
// Tell the curl instance to talk to the server using HTTP POST
curl_setopt($curl, CURLOPT_POST, 1);
// 1 second for a connection timeout with curl
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
// Try using this instead of the php set_time_limit function call
curl_setopt($curl, CURLOPT_TIMEOUT, 60);
// Causes curl to return the result on success which should help us avoid using the writeback option
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
echo $result = curl_exec($curl);