나의 서비스 제공자는 나의 서비스를 받기 위해 다음과 같은 PHP 코드를 제공 해주었습니다. 내 응용 프로그램에서 사용하기 위해 C 언어 코드로 변환하는 데 도움이 필요합니다. 이 코드는 컬 모듈을 사용하여 사이트에 게시합니다. pls 조언.는 PHP 컬 코드를 C 언어로 변환하는 데 도움이 필요합니다.
<?php
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user="myusername":"mypassword"&senderID=TEST SMS&receipientno="phonenum"&msgtxt=This is a test from mVaayoo API&state=4");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&senderID=$senderID&receipientno=$receipientno&cid=$cid&msgtxt=$msgtxt");
$buffer = curl_exec($ch);
if(empty ($buffer))
{ echo " buffer is empty "; }
else
{ echo $buffer; }
curl_close($ch);
?>
php $ ch = curl_init(); curl_setopt ($ ch, CURLOPT_URL, "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user="myusername":"mypassword"&senderID=TEST SMS & receipientno ="phonenum "& msgtxt = mVaayoo API 및 상태의 테스트입니다. = 4 "); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, "사용자 = $ 사용자 & senderID = $ senderID & receipientno = $ receipientno & cid = $ cid & msgtxt = $ msgtxt"); $ buffer = curl_exec ($ ch); if (empty ($ buffer)) {echo "buffer is empty"; } else {echo $ buffer; } curl_close ($ ch); ?> –
libcurl을 시도했지만 작동하지 않습니다. 여기 프로그램이 curl_easy_perform에서 멈추고 반환되지 않는 내 노력입니다. –
int main (void) { CURLcode res; CURL * curl = curl_easy_init(); if (컬) { curl_easy_setopt (컬, CURLOPT_URL, ""); curl_easy_setopt (curl, CURLOPT_POST, 1); curl_easy_setopt (컬, CURLOPT_CONNECTTIMEOUT, 1L); curl_easy_setopt (curl, CURLOPT_TIMEOUT, 1L); curl_easy_setopt (컬, CURLOPT_WRITEFUNCTION, write_callback); res = curl_easy_perform (컬); if (res! = CURLE_OK) fprintf (stderr, "failed : % s", curl_easy_strerror (res)); curl_easy_cleanup (curl); } return -1; } –