Okay, so I tried using this on the comma开发者_如何学Cnd line:
curl -d accountType=GOOGLE -d Email=REDACTED@gmail.com -d Passwd=REDACTED -d service=finance -k https://www.google.com/accounts/ClientLogin
and it seems to work. Even when I pass wrong passwords, it'll tell me that there's bad authentication.
However, when I try using libcurl, it returns "302 moved", instead of badauthentication.
I mean, here's the code:
#include <curl/curl.h>
using namespace std;
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://www.gogle.com/accounts/ClientLogin");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
CURLcode retcode = res = curl_easy_perform(curl);
if(retcode != 0){
cout << "ERROR DETECTED : " << retcode << endl;
}
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
What exactly is happening?
Lots of sites check the user-agent field.
Or you're missing the correct cookies in this request.
精彩评论