2

直接アクセス番号の呼び出しを行うには、Google Voice ログイン ポスト リクエストから gvx Cookie を取得する必要があります。私の理解では、Google Voice は、ログインすると、モバイル デバイスとして識別されたクライアント (正しいユーザー エージェントを設定しました) に gvx Cookie を設定します。

この URL Post Request を使用して正常にログインできます。

https://accounts.google.com/ServiceLogin?ltmpl=mobile&btmpl=mobile&Email=username%40gmail.com&Passwd=mypassword&service=grandcentral&continue=https%3A%2F%2Fwww.google.com%2Fvoice%2Fm&timeStmp=&secTok=&signIn=Sign+in

および USER-Agent:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5

Objective-C コード:

NSString *data = [NSString stringWithFormat:@"ltmpl=mobile&btmpl=mobile&Email=%@&Passwd=%@&service=grandcentral&continue=%@&timeStmp=&secTok=&signIn=Sign+in", self.user.urlEncoded, self.password.urlEncoded, [NSString stringWithFormat:@"https://www.google.com/voice/m"].urlEncoded ];

if (captchaResponse && captchaToken) {
    data = [data stringByAppendingFormat: @"&logintoken=%@&logincaptcha=%@",
            captchaToken.urlEncoded, 
            captchaResponse.urlEncoded];
}

NSData *requestData = [NSData dataWithBytes: [data UTF8String] length: [data length]];

NSURL *url = [NSURL URLWithString: LOGIN_URL_STRING];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url];

[request setHTTPMethod: @"POST"];
[request setHTTPBody: requestData];
[request setValue: USER_AGENT_IPHONE forHTTPHeaderField: USER_AGENT_HEADER];

NSURLResponse *resp = nil;
NSError *err = nil;

NSData *response = [NSURLConnection sendSynchronousRequest: request returningResponse: &resp error: &err];

self.general = [dict objectForKey: RAW_DATA];

    if (self.general) {
        self.rnrSe = [self discoverRNRSE];
    }

    [self fetchSettings];

    NSHTTPCookie *cookie;
    NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
    for (cookie in [cookieJar cookies]) {
        NSLog(@"%@", cookie);
    }

Cookie から返されたのは 3 つの名前だけです。

GALX - with some random characters and numbers value
GAPS - with some random characters and numbers value
S - with value: "grandcentral=xxxxxx..xxxx"

次のようなCookieでさらに多くの情報を取得する必要があります。

HSID, SSID, APISID, PREF, NIDそして最も重要なgvxクッキー。それが私が探しているものです。

gvx Cookie を取得するにはどうすればよいですか?

4

0 に答える 0