24,854
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <curl.h>
#include "com_android_example_JNI.h"
JNIEXPORT jlong JNICALL Java_com_android_example_JNI_getInfo(JNIEnv * e, jobject j){
return getinformation1();
}
long getinformation1(void)
{
CURL *curl;
CURLcode res;
long ct;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://svplayer.shooter.cn/api/pinreport.php");
//curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L);
res = curl_easy_perform(curl);
if(CURLE_OK == res) {
res = curl_easy_getinfo(curl,CURLINFO_RESPONSE_CODE,&ct);
if((CURLE_OK == res)){
printf("CURLINFO_RESPONSE_CODE :%d\n", ct);
}
}
curl_easy_cleanup(curl);
return ct;
}
return 0;
}