In PHP我可以简单地做到这一点:
file_get_contents('http://stackoverflow.com/questions/ask');
执行相同操作的最短代码是什么C?
UPDATE
当我使用curl编译示例时,出现如下错误:
unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
Use libcurl http://curl.haxx.se/,参考他们的C 代码片段示例 http://curl.haxx.se/libcurl/c/example.html
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)