如何在启用SSL的网站上通过curl运行获取请求? [英] How would you run a get request via curl on an ssl enabled website?
问题描述
$url = 'https://thewebsite.com/';
$this->curl->create($url);
$this->curl->ssl(TRUE);
echo $this->curl->simple_get($url);
这是我通过codeigniter和curl codeigniter库运行的代码。
That's the code i'm running via codeigniter and the curl codeigniter library.
有什么办法吗?
当我运行请求时我没有什么。
I get nothing when i run the request.
推荐答案
TRUE
,在这种情况下,站点对SSL证书。如果你有证书,那么你需要传入第三个参数curl-> ssl(证书的路径)。
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.
有关cURL和SSL的更多信息此处(不是CodeIgniter,只是常规ol'PHP + cURL)。
More on cURL and SSL here (not CodeIgniter, just regular ol' PHP + cURL).
这篇关于如何在启用SSL的网站上通过curl运行获取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!