c++ curl 함수에 변수넣기 질문드립니다.
글쓴이: -@Naver / 작성시간: 월, 2019/08/05 - 5:22오후
curl 공식 홈페이지에 있는 http post 예제 코드에서 제가 필요한 부분을 수정하였습니다.
궁금한 것은
1.if문 내에서 addr에 어떤 배열의 원소 0번 index부터 5번 index 까지의 값을 순차적으로
넣고 싶을때는 몇번 라인에 반복문을 써야하나요?
2.curl_easy_setopt 함수에 어떻게 배열값을 넣나요?
코드첨부합니다.
//배열 arr[6] 존재
1 CURL *curl;
2 CURLcode res;
3 curl_global_init(CURL_GLOBAL_ALL);
4 curl = curl_easy_init();
5 if (curl) {
6 curl_easy_setopt(curl, CURLOPT_URL, "http://cafe24아이디/구현한php파일이름.php");
7 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "addr=배열의 원소를 넣기");
8 res = curl_easy_perform(curl);
9 if (res != CURLE_OK)
10 fprintf(stderr, "curl_easy_perform() failed: %s\n",
11 curl_easy_strerror(res));
12 curl_easy_cleanup(curl);
13 }
14 curl_global_cleanup();
Forums:
댓글 달기