wget下载文件 - --no-check-certificate错误?

时间:2017-03-13 16:31:33

标签: php csv ssl cron wget

我有一个cron,它每24小时将一个csv数据下载到我的服务器。因为承载此csv的提供商只允许浏览器下载csv文件,所以我伪造了我的身份。但问题是我仍然遇到错误。

有谁知道如何解决这个问题?

我的wget查询:

wget --no-check-certificate -O "/httpdocs/cronjob/data/gamesdeal.csv" "http://www.gamesdeal.com/media/feedgenerator/Gamekey.csv" --header="User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:23.0) Gecko/20100101 Firefox/23.0" --header="Accept: image/png,image/*;q=0.8,*/*;q=0.5" --header="Accept-Language: en-US,en;q=0.5" --header="Accept-Encoding: gzip, deflate" --header="Referer: http://www.gamesdeal.com"

我的返回错误:

--2017-03-13 02:55:02--  http://www.gamesdeal.com/media/feedgenerator/Gamekey.csv
Resolving www.gamesdeal.com (www.gamesdeal.com)... 104.25.181.29, 104.25.180.29, 2400:cb00:2048:1::6819:b41d, ...
Connecting to www.gamesdeal.com (www.gamesdeal.com)|104.25.181.29|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.gamesdeal.com/media/feedgenerator/Gamekey.csv [following]
--2017-03-13 02:55:02--  https://www.gamesdeal.com/media/feedgenerator/Gamekey.csv
Connecting to www.gamesdeal.com (www.gamesdeal.com)|104.25.181.29|:443... connected.
WARNING: cannot verify www.gamesdeal.com's certificate, issued by 'CN=COMODO ECC Domain Validation Secure Server CA 2,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB':
  Unable to locally verify the issuer's authority.
HTTP request sent, awaiting response... 200 OK
Length: 623444 (609K) [application/octet-stream]
Saving to: '/httpdocs/cronjob/data/gamesdeal.csv'

     0K .......... .......... .......... .......... ..........  8% 2.58M 0s
    50K .......... .......... .......... .......... .......... 16% 3.96M 0s
   100K .......... .......... .......... .......... .......... 24% 6.85M 0s
   150K .......... .......... .......... .......... .......... 32% 8.32M 0s
   200K .......... .......... .......... .......... .......... 41% 5.89M 0s
   250K .......... .......... .......... .......... .......... 49% 10.2M 0s
   300K .......... .......... .......... .......... .......... 57% 10.4M 0s
   350K .......... .......... .......... .......... .......... 65% 6.14M 0s
   400K .......... .......... .......... .......... .......... 73% 8.54M 0s
   450K .......... .......... .......... .......... .......... 82% 9.62M 0s
   500K .......... .......... .......... .......... .......... 90% 7.48M 0s
   550K .......... .......... .......... .......... .......... 98% 4.24M 0s
   600K ........                                              100% 10.9M=0.1s

2017-03-13 02:55:02 (5.97 MB/s) - '/httpdocs/cronjob/data/gamesdeal.csv' saved [623444/623444]

问候,谢谢!

1 个答案:

答案 0 :(得分:3)

没有错误,但警告。尽管验证失败,--no-check-certificate仍会wget继续,但它仍然会抱怨 - 如果设置wget,只要验证失败就会停止{<1}}。

如果您故意使用该选项,则无需担心。如果您想要摆脱它,您只需要使用来自广为人知的CA的证书,或者使用--ca-directory--ca-certificate等选项让wget知道您的证书颁发者。

wget docs:2.8 HTTPS (SSL/TLS) Options

修改

受信任的证书基本上是指应用程序已知的CA颁发的证书 - 已知和受信任的CA的数据库,如果您的证书匹配,则一切正常。如果没有,则显示警告。要摆脱这种情况,您需要告诉应用程序您希望它也信任您的CA,并且这可以通过使用前面提到的选项来实现。