int doHttpPost(const char* url,const char* data,long timeout,long withheader )
{
resetOpt();
::curl_easy_setopt( m_curl, CURLOPT_HEADER, withheader);
::curl_easy_setopt( m_curl, CURLOPT_URL, url);
::curl_easy_setopt( m_curl, CURLOPT_POST, 1);
::curl_easy_setopt( m_curl, CURLOPT_POSTFIELDS, data);
::curl_easy_setopt( m_curl, CURLOPT_TIMEOUT, timeout);
::curl_easy_setopt( m_curl, CURLOPT_WRITEFUNCTION, CCUrl::processFunc);
::curl_easy_setopt( m_curl, CURLOPT_WRITEDATA,this );
CURLcode res = ::curl_easy_perform( m_curl);
return ( 0== res ) ? 0 :-1;
}
char* url
= "http://forum.byr.edu.cn/wForum/logon.php";
string postValue="{\"name\":\"rwb\", \"biz\":132, \"id\":"+id+"}";
doHttpPost( url, postValue
.c_str(), 10,0);