Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
一些返回302的google服务(clientlogin)在使用libcurl时被移动_Curl_Libcurl - Fatal编程技术网

一些返回302的google服务(clientlogin)在使用libcurl时被移动

一些返回302的google服务(clientlogin)在使用libcurl时被移动,curl,libcurl,Curl,Libcurl,好的,我试着在命令行上使用这个: curl -d accountType=GOOGLE -d Email=REDACTED@gmail.com -d Passwd=REDACTED -d service=finance -k https://www.google.com/accounts/ClientLogin 这似乎奏效了。即使我传递了错误的密码,它也会告诉我存在错误的身份验证 但是,当我尝试使用libcurl时,它返回302moved,而不是badcuthentication 我的意思是,

好的,我试着在命令行上使用这个:

curl -d accountType=GOOGLE -d Email=REDACTED@gmail.com -d Passwd=REDACTED -d service=finance -k https://www.google.com/accounts/ClientLogin
这似乎奏效了。即使我传递了错误的密码,它也会告诉我存在错误的身份验证

但是,当我尝试使用libcurl时,它返回302moved,而不是badcuthentication

我的意思是,代码如下:

#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;
}

到底发生了什么?

许多网站都检查用户代理字段

或者您在此请求中缺少正确的cookie