gpt4 book ai didi

c - Http在c中向wordpress发表评论

转载 作者:行者123 更新时间:2023-11-30 16:03:58 25 4
gpt4 key购买 nike

我无法使用curl在c中向wordpress页面发表评论。我尝试了formadd,但它没有再次发生。

<input id="author" name="author" type="text" value="" size="30" aria-required="true">
<input id="email" name="email" type="text" value="" size="30" aria-required="true">
<input id="url" name="url" type="text" value="" size="30">
<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
<input name="submit" type="submit" id="submit" value="Yorum Yaz">

我应该如何发帖?

最佳答案

这是一个简单的 curl 示例。如果要求是严格的 C 而不是 C++,请将下面的 std::string 更改为 char 数组。

CURL *curl;
CURLcode res;
std::string postParams;

//Set parameters
postParams.clear();
postParams.append("&parameter1=");
postParams.append("data");
postParams.append("&parameter2=");
postParams.append("more data");

//Initialize curl
curl = curl_easy_init();

if(curl){
//Set site
curl_easy_setopt(curl, CURLOPT_URL, "http://www.yoursite.com");

//Use post, set parameters
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (char *)postParams.c_str());

//Perform the session
res = curl_easy_perform(curl);

//Cleanup the session
curl_easy_cleanup(curl);
}

if(res == 0){
//Success
}
else{
//Failure
}

关于c - Http在c中向wordpress发表评论,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3657548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com