看了下,,收下了这个代码,
void delete_page(string id,CURL* curl)
{
bduss_lock.lock();
string tbs;
curl_easy_setopt(curl,CURLOPT_COOKIE,bduss.c_str());
curl_easy_setopt(curl, CURLOPT_URL,"
https://tieba.baidu.com/dc/common/tbs");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,download);
curl_easy_setopt(curl, CURLOPT_WRITEDATA,&tbs);
curl_easy_perform(curl);
//Sleep(4000);
bduss_lock.unlock();
curl_easy_setopt(curl,CURLOPT_COOKIE,bduss.c_str());
curl_easy_setopt(curl, CURLOPT_URL, "
https://tieba.baidu.com/f/commit/thread/delete");
//curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, get_erron);
string send_data="Referer:
https://tieba.baidu.com/p/"+id;
struct curl_slist* headers=NULL;
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "Accept: */*");
headers = curl_slist_append(headers, send_data.c_str());
headers = curl_slist_append(headers, "Accept-Language: zh-cn");
headers = curl_slist_append(headers, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)");
headers = curl_slist_append(headers, "Connection: Keep-Alive");
headers = curl_slist_append(headers, "Cache-Control: no-cache");
headers = curl_slist_append(headers, "DNT: 1");//%E5%9C%A3%E5%AE%89%E5%9C%B0%E5%88%97%E6%96%AF&fid=485838
send_data="commit_fr=pb&ie=utf-8&tbs="+make_tbs(tbs)+"&kw="+url(f_name)+"&fid="+f_id+"&tid="+id;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, send_data.c_str());
bduss_lock.lock();
curl_easy_perform(curl);
Sleep(4000);
bduss_lock.unlock();
}
void delete_reply(string tiezi_id,string qoute_id,CURL* curl)
{
bduss_lock.lock();
string tbs;
curl_easy_setopt(curl,CURLOPT_COOKIE,bduss.c_str());
curl_easy_setopt(curl,CURLOPT_URL,"
https://tieba.baidu.com/dc/common/tbs");
curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,download);
curl_easy_setopt(curl,CURLOPT_WRITEDATA,&tbs);
curl_easy_perform(curl);
bduss_lock.unlock();
string send_data="commit_fr=pb&ie=utf-8&tbs="+make_tbs(tbs)+"&kw="+url(f_name)+"&fid="+f_id+"&tid="+tiezi_id+"&is_vipdel=1&pid="+qoute_id+"&is_finf=false";
//send_data=send_data;
curl_easy_setopt(curl,CURLOPT_COOKIE,bduss.c_str());
curl_easy_setopt(curl, CURLOPT_URL, "
https://tieba.baidu.com/f/commit/post/delete");
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, send_data.c_str());
bduss_lock.lock();
curl_easy_perform(curl);
Sleep(4000);
bduss_lock.unlock();
}
有空我用JAVA写个,怼服务器上去,
void input()
{
cout<<"input tie ba name"<<endl;
cin>>f_name;
cout<<"input tie ba id"<<endl;
cin>>f_id;
cout<<"input bduss"<<endl;
cin>>bduss;
cout<<"input delete level,每个一行,0 is endl input"<<endl;
string temp="0";
for(;;)
{
cin>>temp;
if(temp=="0")
break;
else
level.push_back(temp);
}
standard st;
char temp2='n';
for(;;)
{
cout<<"input the least baling"<<endl;
cin>>st.age;
cout<<"input the least fatie"<<endl;
cin>>st.words;
cout<<"end input?"<<endl;
cin>>temp2;
standard_team.push_back(st);
if(temp2=='y')
{
//sort_s();
return;
}
}
}
使用部分的代码。。
,,,