嗨,我是 Tizen SDK 和开发手表应用程序的新手。使用 curl 发布/获取时遇到错误。以下是我正在使用的代码,有人可以帮忙吗?
CURL *curl;
CURLcode res;
dlog_print(DLOG_DEBUG, TAG, "curl start");
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
dlog_print(DLOG_DEBUG, TAG, "curl init");
/* Set CURL parameters */
/* First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
/* Now specify the POST data */
//curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "w=4&project=curl");
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
dlog_print(DLOG_DEBUG, TAG, "curl_easy_perform() Failed: %s\n",curl_easy_strerror(res));
else{
dlog_print(DLOG_DEBUG, TAG, "curl_easy_perform() Success");
}
/* always cleanup */
curl_easy_cleanup(curl);
}
else{
dlog_print(DLOG_DEBUG, TAG, "curl failed");
}
curl_global_cleanup();
编辑:错误是“无法解析主机名”