【发布时间】:2011-06-12 17:08:31
【问题描述】:
这可能是一个愚蠢的问题,但我实际上如何获取 curl_easy_perform() 返回的站点数据到我可以使用的变量中。当它执行时,我只是看到它在终端上一闪而过。顺便说一句,我正在使用 C。
有什么想法吗?谢谢。
编辑: 这是我正在使用的代码(我正在访问 Twitter Streaming API,我做得对吗?)
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://stream.twitter.com/1/statuses/filter.json?track=http");
curl_easy_setopt(curl, CURLOPT_USERPWD, "JEggers2:password");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
【问题讨论】: