所以我试图重做这段代码,但 C++ https://bitbucket.org/jitbit/sharpgooglevoice/src/0d76122c5bd7f4000352e003c9990d62f2421693/SharpGoogleVoice.cs?at=default
但是,我认为我的代码是相同的,但它似乎没有工作。
int SendSMS(string number, string msg)
{
Login();
curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com/voice/sms/");
curl_easy_setopt(curl, CURLOPT_POST, 1);
number = curl_easy_escape(curl, number,0);
rnr_se = curl_easy_escape(curl, rnr_se.c_str(),0);
string data = "sendphoneNumber=" + number;
data += "&text=" + msg;
data += "&_rnr_se=" + rnr_se;
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());
cr = curl_easy_perform(curl);
}
然而什么也没有发生。我知道 Login() 可以正常工作,因为我能够登录并检查消息。我的输出与 C# 代码中的输出相同,但由于某种原因,这没有任何作用
url 格式应该是这个 POST /voice/sms/send/phoneNumber=[number to text]&text=[URL Encoded message]&_rnr_se=[pull from page]