0

I use the following PHP curl request to scrape the data from a remote website:

$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // Skip SSL Verification
$rsData = curl_exec($ch);
curl_close($ch);
return $rsData;

Now when I try to scrape the data from https://www.dsebd.org, I have to mention https:// in the $URL. Without mentioning the https://, no data is retrieving. But as far I can understand, as CURLOPT_SSL_VERIFYPEER is set to 0, I can omit the https:// from the $URL.

Then, why the CURLOPT_SSL_VERIFYPEER is not working in my case?

  • no that's not what it means, https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYPEER.html –  May 05 '19 at 04:18
  • http://xyproblem.info/ ? – mario May 05 '19 at 04:31
  • Without HTTPS, **www.dsebd.org** domain will be redirect to HTTPS (HTTP 302). To skip SSL verification for any other domains that is not redirect, [try this](https://stackoverflow.com/questions/15135834/php-curl-curlopt-ssl-verifypeer-ignored) – vee Dec 02 '21 at 13:45

0 Answers0