Http client extension based on Yii 2 under Windows 10 64 bit, requesting HTTPS, error: “CURL ERROR: #60 – SSL Certificate Problem: Unablem: Unable To get local issuer certificate”

基于 Yii 2 的 HTTP 客户端扩展,请求https,报错:"Curl error: #60 - SSL certificate problem: unable to get local issuer certificate"

1. HTTP client extension based on Yii 2, request https, and report an error: “curl error: #60 – SSL Certificate Problem: Unable to get local Issuer certificate”, as shown in Figure 1

基于 Yii 2 的 HTTP 客户端扩展,请求https,报错:"Curl error: #60 - SSL certificate problem: unable to get local issuer certificate"
Figure 1

2. Configure the client through the application formation, deletedeal=>Yii\HttpClient\CurlTransportThis configuration, as shown in Figure 2

通过应用组建配置客户端,删除 'transport' => 'yii\httpclient\CurlTransport' 此项配置
Figure 2

3. HTTP client extension based on Yii 2, request HTTPS, normal, as shown in Figure 3

基于 Yii 2 的 HTTP 客户端扩展,请求https,正常
Figure 3

4. View the document: https://github.com/yiisoft/yii2-httpClient /blob/master/docs/guide-en-en/usage-transports.md , CURLTransport can support advanced functions, such as batch requests (so, due to the needs of batch requests, the transmission method used by the client must be configured as CURLTransport), as shown in Figure 4

查看文档:https://github.com/yiisoft/yii2-httpclient/blob/master/docs/guide-zh-CN/usage-transports.md ,CurlTransport可支持高级功能,例如批量请求(因此,由于有批量请求的需要,必须配置客户端使用的传输方式为CurlTransport)
Figure 4

5. Open the URL: https://curl.haxx.se/docs/caextract.html , download and extract cacert.pem (a clean file format/data) here, copy it to: C:\PHP-7.1.12\Extras\SSL\Cacet.pem, as shown in Figure 5

打开网址:https://curl.haxx.se/docs/caextract.html ,在这里下载并提取cacert.pem(一个干净的文件格式/数据),复制至:C:\php-7.1.12\extras\ssl\cacert.pem
Figure 5

6. Edit php.ini, modify ; curl.cainfo = curl.cainfo = “C:\php-7.12\extras\ssl\cacert.pem”, restart php, as shown in Figure 6

编辑 php.ini,修改 ;curl.cainfo = 为 curl.cainfo = "C:\php-7.1.12\extras\ssl\cacert.pem",重启PHP
Figure 6

7. Since cookies have been disabled for RESTful applications, cookies are only transmitted as request header information, as shown in Figure 7

由于为 RESTful 应用,Cookies已经被禁用,因此 Cookies 仅作为请求头信息传输
Figure 7

8. Configure the client through the application formation, restoredeal=>Yii\HttpClient\CurlTransportThis configuration, request https, normal, as shown in Figure 8

通过应用组建配置客户端,恢复 'transport' => 'yii\httpclient\CurlTransport' 此项配置,请求https,正常
8

9. Check the log information of the debug, the settings of the cookie are as expected, as shown in Figure 9

cookie: login_chinamcloud_id=13980074657; login_chinamcloud_tid=c7a8106ea2da1d5c01a13234c69ea8

查看 Debug 的日志信息,Cookie的设置符合预期
Figure 9

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.