1

我已经阅读了几篇关于登录需要电子邮件和密码的网站的帖子,但我找不到关于登录到名为geni.com的特定网站的解决方案..有没有办法

        CookieContainer cookie;
        string user = "somemail@somehost.com";
        string pass = "123456";

        string formUrl = "http://www.geni.com/login/";
        string formParams = String.Format("profile_username={0}&password={1}", "MYUSERNAME", "MYPASS");
        string cookieHeader;
        HttpWebRequest myWebRequest;
        WebResponse myWebResponse; 
        String URL = textBox1.Text;
        myWebRequest = (HttpWebRequest)WebRequest.Create("formUrl");
        myWebRequest.ContentType = "application/x-www-form-urlencoded";
        myWebRequest.Method = "POST";
        string login = string.Format("go=&Fuser={0}&Fpass={1}", user, pass);

        byte[] postbuf = Encoding.ASCII.GetBytes(login);


         myWebResponse = myWebRequest.GetResponse(); //Returns a response from an Internet resource
        cookieHeader = myWebResponse.Headers["Set-cookie"];
        cookie = myWebRequest.CookieContainer = new CookieContainer();
        myWebRequest.CookieContainer = cookie;
        Stream streamResponse = myWebResponse.GetResponseStream(); 

        StreamReader sreader = new StreamReader(streamResponse);
        Rstring = sreader.ReadToEnd();

我有点迷茫,谁能帮帮我??

4

1 回答 1

1

这是他们的API 文档的链接。要登录,您需要像这样调用他们的 API:

https://www.geni.com/platform/oauth/request_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials 
于 2012-11-12T22:23:00.760 回答