我需要从HTTPS网址下载图片。我知道我们可以从远程HTTP URL使用cURL下载图像但是HTTPS协议失败,它返回空白图像。
这样做有什么特别的伎俩吗?网站我必须从amazon.com下载图像
答案 0 :(得分:1)
curl
可以正常使用HTTPS。从手册页:
curl is a tool to transfer data from or to a server, using one of the
supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP,
IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS,
TELNET and TFTP). The command is designed to work without user interac-
tion.
您可能会遇到证书验证问题。
您可以告诉curl
忽略这些内容,请参阅-k
选项:
-k, --insecure
(SSL) This option explicitly allows curl to perform "insecure"
SSL connections and transfers. All SSL connections are attempted
to be made secure by using the CA certificate bundle installed by
default. This makes all connections considered "insecure" fail
unless -k, --insecure is used.
See this online resource for further details:
http://curl.haxx.se/docs/sslcerts.html