我已经阅读了几篇关于登录需要电子邮件和密码的网站的帖子,但是我找不到关于登录到名为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();
我有点困惑,任何人都可以帮助我吗?
答案 0 :(得分:1)
这是指向API documentation的链接。要登录,您需要像这样调用他们的API:
https://www.geni.com/platform/oauth/request_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials