我使用下面的代码来检查http服务器上的文件是否存在。但是我得到了CURLE_COULDNT_CONNECT代码。谁能告诉我如何使用lib curl检查文件是否存在?
curl_easy_setopt(curl, CURLOPT_URL, "http://www.thekevindolan.com/wp-content/uploads/2010/02/15_19_1-Tree-Sunrise-Northumberland_web.jpg");
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
/* Do not do the transfer - only connect to host */
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
CURLcode res = curl_easy_perform(curl);发布于 2012-09-15 02:14:50
CURLE_COULDNT_CONNECT表示TCP连接失败。您无法从运行该代码的机器上连接到端口80上的HTTP服务器!
https://stackoverflow.com/questions/12424205
复制相似问题