How to get file_get_contents() to work with HTTPS?

后端 未结 12 2129
长发绾君心
长发绾君心 2020-11-21 23:38

I\'m working on setting up credit card processing and needed to use a workaround for CURL. The following code worked fine when I was using the test server (which wasn\'t cal

12条回答
  •  没有蜡笔的小新
    2020-11-22 00:42

    I was stuck with non functional https on IIS. Solved with:

    file_get_contents('https.. ) wouldn't load.

    • download https://curl.haxx.se/docs/caextract.html
    • install under ..phpN.N/extras/ssl
    • edit php.ini with:

      curl.cainfo = "C:\Program Files\PHP\v7.3\extras\ssl\cacert.pem" openssl.cafile="C:\Program Files\PHP\v7.3\extras\ssl\cacert.pem"

    finally!

提交回复
热议问题