Interardo
Interardo

Reputation: 53

PHP Curl but the HTML is Encrypted and SSL Certificate: unable to get local issuer certificate

I want to parse the HTML from this site, I already try to use :

  1. file_get_contents
  2. Simple HTML DOM

but the result is awful like this :

enter image description here

then I try PHP CURL by using php html parser, I found the error is SSL certificate problem: unable to get local issuer certificate

After searching the answer, then I read using curl to access https, and I try to get the certificate by using the step in that article but the result is same

the question is, why the parsing result is like that? now, I don't know what to do :(

Upvotes: 1

Views: 1523

Answers (1)

Alex
Alex

Reputation: 66

The page is compressed with gzip.

curl -k --compressed https://inaproc.lkpp.go.id/v3/daftar_lpse

For PHP

$ch = curl_init("https://inaproc.lkpp.go.id/v3/daftar_lpse");
curl_setopt($ch, CURLOPT_ENCODING , "");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);
echo $output;

Upvotes: 5

Related Questions