facebook login.
-
hey im trying to make an app that will log in to facebook , im using the following method to establish connection and post my credentials:
public static void start_post(string strPage, string strBuffer) { //Our postvars byte[] buffer = Encoding.ASCII.GetBytes(strBuffer); //Initialisation HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(strPage); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method = "POST"; //We use form contentType, for the postvars. WebReq.ContentType = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. WebReq.ContentLength = buffer.Length; //We open a stream for writing the postvars WebReq.Referer = "http://www.facebook.com/index.php?"; Stream PostData = WebReq.GetRequestStream(); //Now we write, and afterwards, we close. Closing is always important! PostData.Write(buffer, 0, buffer.Length); PostData.Close(); //Get the response handle, we have no true response yet! HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); //Let's show some information about the response Console.WriteLine(WebResp.StatusCode); Console.WriteLine(WebResp.Server); //Now, we read the response (the string), and output it. Stream Answer = WebResp.GetResponseStream(); StreamReader _Answer = new StreamReader(Answer); reply = _Answer.ReadToEnd(); Console.WriteLine(reply); }
i get the following respond from facebook: "sorry, we're not cool enough to support your browser. please keep it real with the following browsers: ...." any idea how to work around this facebook check , as im sending same data as my IE agent i dont know what else will work , asking for your expert help. thank you.Net
-
hey im trying to make an app that will log in to facebook , im using the following method to establish connection and post my credentials:
public static void start_post(string strPage, string strBuffer) { //Our postvars byte[] buffer = Encoding.ASCII.GetBytes(strBuffer); //Initialisation HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(strPage); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method = "POST"; //We use form contentType, for the postvars. WebReq.ContentType = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. WebReq.ContentLength = buffer.Length; //We open a stream for writing the postvars WebReq.Referer = "http://www.facebook.com/index.php?"; Stream PostData = WebReq.GetRequestStream(); //Now we write, and afterwards, we close. Closing is always important! PostData.Write(buffer, 0, buffer.Length); PostData.Close(); //Get the response handle, we have no true response yet! HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); //Let's show some information about the response Console.WriteLine(WebResp.StatusCode); Console.WriteLine(WebResp.Server); //Now, we read the response (the string), and output it. Stream Answer = WebResp.GetResponseStream(); StreamReader _Answer = new StreamReader(Answer); reply = _Answer.ReadToEnd(); Console.WriteLine(reply); }
i get the following respond from facebook: "sorry, we're not cool enough to support your browser. please keep it real with the following browsers: ...." any idea how to work around this facebook check , as im sending same data as my IE agent i dont know what else will work , asking for your expert help. thank you.Net
udikantz wrote:
as im sending same data as my IE agent i dont know what else will work
And just where do you set that? I dont see it anywhere in your code. Try again.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008) -
udikantz wrote:
as im sending same data as my IE agent i dont know what else will work
And just where do you set that? I dont see it anywhere in your code. Try again.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)i set that in a the main class of the project these are the parameters that i pass to the method , i chenged the email and password to something fake be it looks something like that: start_post("https://login.facebook.com/login.php", "challenge=e7d654f99268a01kl94007be0e399755&md5pass=1&noerror=1&email=someemail@gmail.com&pass=coolpassword&charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84");
Net
-
hey im trying to make an app that will log in to facebook , im using the following method to establish connection and post my credentials:
public static void start_post(string strPage, string strBuffer) { //Our postvars byte[] buffer = Encoding.ASCII.GetBytes(strBuffer); //Initialisation HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(strPage); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method = "POST"; //We use form contentType, for the postvars. WebReq.ContentType = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. WebReq.ContentLength = buffer.Length; //We open a stream for writing the postvars WebReq.Referer = "http://www.facebook.com/index.php?"; Stream PostData = WebReq.GetRequestStream(); //Now we write, and afterwards, we close. Closing is always important! PostData.Write(buffer, 0, buffer.Length); PostData.Close(); //Get the response handle, we have no true response yet! HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); //Let's show some information about the response Console.WriteLine(WebResp.StatusCode); Console.WriteLine(WebResp.Server); //Now, we read the response (the string), and output it. Stream Answer = WebResp.GetResponseStream(); StreamReader _Answer = new StreamReader(Answer); reply = _Answer.ReadToEnd(); Console.WriteLine(reply); }
i get the following respond from facebook: "sorry, we're not cool enough to support your browser. please keep it real with the following browsers: ...." any idea how to work around this facebook check , as im sending same data as my IE agent i dont know what else will work , asking for your expert help. thank you.Net
I had the same problem and i used the line
WebReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729)";
it makes the server think that its running FireFox
-
hey im trying to make an app that will log in to facebook , im using the following method to establish connection and post my credentials:
public static void start_post(string strPage, string strBuffer) { //Our postvars byte[] buffer = Encoding.ASCII.GetBytes(strBuffer); //Initialisation HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(strPage); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method = "POST"; //We use form contentType, for the postvars. WebReq.ContentType = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. WebReq.ContentLength = buffer.Length; //We open a stream for writing the postvars WebReq.Referer = "http://www.facebook.com/index.php?"; Stream PostData = WebReq.GetRequestStream(); //Now we write, and afterwards, we close. Closing is always important! PostData.Write(buffer, 0, buffer.Length); PostData.Close(); //Get the response handle, we have no true response yet! HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); //Let's show some information about the response Console.WriteLine(WebResp.StatusCode); Console.WriteLine(WebResp.Server); //Now, we read the response (the string), and output it. Stream Answer = WebResp.GetResponseStream(); StreamReader _Answer = new StreamReader(Answer); reply = _Answer.ReadToEnd(); Console.WriteLine(reply); }
i get the following respond from facebook: "sorry, we're not cool enough to support your browser. please keep it real with the following browsers: ...." any idea how to work around this facebook check , as im sending same data as my IE agent i dont know what else will work , asking for your expert help. thank you.Net
hi this code is running fine Facebook Login
protected void Page_Load(object sender, EventArgs e)
{
//string strBuffer = "email=" + username + "&pass=" + Password + "&login=Login";
string strBuffer = "email=xxxxxxxxxxx&pass=xxxxxxxxxxxxx;login=Login";start\_post(strBuffer); } public void start\_post(string strBuffer) { //Our postvars byte\[\] buffer = System.Text.Encoding.ASCII.GetBytes(strBuffer); //Initialisation HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create("https://login.facebook.com/login.php?m&next=http%3A%2F%2Fm.facebook.com%2Fhome.php"); //Our method is post, otherwise the buffer (postvars) would be useless WebReq.Method = "POST"; //We use form contentType, for the postvars. WebReq.ContentType = "application/x-www-form-urlencoded"; //The length of the buffer (postvars) is used as contentlength. WebReq.ContentLength = buffer.Length; //We open a stream for writing the postvars WebReq.Referer = "http://www.facebook.com/index.php?"; Stream PostData = WebReq.GetRequestStream(); //Now we write, and afterwards, we close. Closing is always important! PostData.Write(buffer, 0, buffer.Length); PostData.Close(); //Get the response handle, we have no true response yet! // HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse(); // //Let's show some information about the response //WebResp.StatusCode; //WebResp.Server; //Now, we read the response (the string), and output it. using (HttpWebResponse response = (HttpWebResponse)WebReq.GetResponse()) { using (StreamReader reader = new StreamReader(response.GetResponseStream())) { Response.Write(reader.ReadToEnd()); } } }
modified on Monday, November 2, 2009 7:32 AM