php curl download failed solution: first open the corresponding PHP file; then add "curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);" and other code statements and save the changes.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
The reason why PHP CURL cannot be downloaded, https Site
Use php curl to download, http site can, but https site cannot capture the content.
Solution
Add 3 lines
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($ch, CURLOPT_CAINFO, \Yii::getAlias('@app/config/cacert.pem'));
Download cacert.pem
Download address: https://curl.haxx .se/docs/caextract.html
[Recommended learning: "PHP Video Tutorial"]
The above is the detailed content of What to do if php curl download fails. For more information, please follow other related articles on the PHP Chinese website!