コードヲチョットソウジシタ
This commit is contained in:
@@ -40,13 +40,6 @@ void postInterface::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
|||||||
for (const auto& [key, value] : bodyParam_) {
|
for (const auto& [key, value] : bodyParam_) {
|
||||||
tmp.push_back(key + "=" + value);
|
tmp.push_back(key + "=" + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for(auto v : tmp){
|
|
||||||
requestBody += (v + "&");
|
|
||||||
}
|
|
||||||
if(!requestBody.empty()){
|
|
||||||
requestBody.pop_back();
|
|
||||||
}*/
|
|
||||||
requestBody = CocoaTweet::Util::join(tmp, "&");
|
requestBody = CocoaTweet::Util::join(tmp, "&");
|
||||||
}
|
}
|
||||||
std::cout << "request Body -> " << requestBody << std::endl;
|
std::cout << "request Body -> " << requestBody << std::endl;
|
||||||
@@ -67,15 +60,13 @@ void postInterface::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
|||||||
CURLcode res;
|
CURLcode res;
|
||||||
std::string rcv;
|
std::string rcv;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
url_ = url_; // + "?status=" + status_;
|
url_ = url_;
|
||||||
std::cout << "URL : " << url_ << std::endl;
|
std::cout << "URL : " << url_ << std::endl;
|
||||||
if (curl) {
|
if (curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url_.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, url_.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
curl_easy_setopt(curl, CURLOPT_POST, 1);
|
||||||
// if(!requestBody.empty()){
|
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, requestBody.c_str());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, requestBody.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, requestBody.length());
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, requestBody.length());
|
||||||
// }
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlCallback_);
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlCallback_);
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (std::string*)&rcv);
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (std::string*)&rcv);
|
||||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||||
@@ -83,7 +74,6 @@ void postInterface::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
|||||||
struct curl_slist* headers = NULL;
|
struct curl_slist* headers = NULL;
|
||||||
// Authorizationをヘッダに追加
|
// Authorizationをヘッダに追加
|
||||||
headers = curl_slist_append(headers, oauthHeader.c_str());
|
headers = curl_slist_append(headers, oauthHeader.c_str());
|
||||||
// headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
|
|
||||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
#include "cocoatweet/api/status/destroy.h"
|
#include "cocoatweet/api/status/destroy.h"
|
||||||
|
|
||||||
namespace CocoaTweet::API::Statuses {
|
namespace CocoaTweet::API::Statuses {
|
||||||
Destroy::Destroy() {
|
Destroy::Destroy() {}
|
||||||
}
|
|
||||||
void Destroy::id(const std::string _id) {
|
void Destroy::id(const std::string _id) {
|
||||||
url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json";
|
url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,16 +28,7 @@ std::map<std::string, std::string> OAuth1::signature(
|
|||||||
tmp.push_back(key + "=" + value);
|
tmp.push_back(key + "=" + value);
|
||||||
std::cout << (key + "=" + value) << std::endl;
|
std::cout << (key + "=" + value) << std::endl;
|
||||||
}
|
}
|
||||||
//std::ostringstream os;
|
|
||||||
//std::copy(tmp.begin(), tmp.end(), std::ostream_iterator<std::string>(os, "&"));
|
|
||||||
//std::string query = os.str();
|
|
||||||
/*std::string query = "";
|
|
||||||
for(auto v : tmp){
|
|
||||||
query += (v + "&");
|
|
||||||
}
|
|
||||||
if(!query.empty()){
|
|
||||||
query.pop_back();
|
|
||||||
}*/
|
|
||||||
std::string query = CocoaTweet::Util::join(tmp, "&");
|
std::string query = CocoaTweet::Util::join(tmp, "&");
|
||||||
|
|
||||||
auto significateKey = key().consumerSecret() + "&" + key().accessTokenSecret();
|
auto significateKey = key().consumerSecret() + "&" + key().accessTokenSecret();
|
||||||
|
|||||||
@@ -31,6 +31,5 @@ std::string join(const std::vector<std::string> _vec, const std::string& _delim)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
||||||
}
|
}
|
||||||
} // namespace CocoaTweet::Util
|
} // namespace CocoaTweet::Util
|
||||||
|
|||||||
Reference in New Issue
Block a user