How would you run a get request via curl on an ssl

2019-07-30 00:22发布

问题:

$url = 'https://thewebsite.com/';
    $this->curl->create($url);
    $this->curl->ssl(TRUE);

    echo $this->curl->simple_get($url);

That's the code i'm running via codeigniter and the curl codeigniter library.

Is there any way around this?

I get nothing when i run the request.

回答1:

TRUE, in this case, means that you are checking their site against an SSL certificate. If you have the certificate, then you need to pass in the third parameter of curl->ssl (the path to the certificate). If you don't want to check against their certificate, then you can simply pass FALSE as the parameter to the ssl method.

More on cURL and SSL here (not CodeIgniter, just regular ol' PHP + cURL).