Yes thats exactly what im trying to do. Im not using a browser. Im just performing the functions a browser does in the background. But instead of WebRequest, im using WebClient. Its almost same thing so shouldnt be any difficulty.
But the problem is that I am unable to login properly. I posted a link to my code, have a look. I cant figure out what Im missing. On Nov 30, 1:17 pm, Processor Devil <[email protected]> wrote: > man, you don't even need a browser... All you need is WebRequest and > cookies! > > 2009/11/30 Faraz Azhar <[email protected]> > > > > > Guys why do I need APIs for that ? Im just trying to do a simple > > logging-in into facebook. Its a simple browser function. > > > If any browser can sign into facebook, then WebClient can also do it > > im sure. The question is not only facebook specific, it can be for any > > website that requires logging-in thru cookies and ID/Password. > > > On Nov 29, 8:24 pm, ThanderMaX <[email protected]> wrote: > > > To connect to facebook from code , u need to lunch their login window > > > in a webcontrol and handle the proper events . > > > > Take a look in the following link : > > > >http://wiki.developers.facebook.com/index.php/Authorization_and_Authe... > > > > Above code is written , most probably Mac OSx in mind. But it's the > > > coding style that is important. > > > > But most importantly , you need to have a developer specific API key , > > > which will be used for tracking and house-keeping (internally). Please > > > do register in the parent site and get your key. > > > [Same procedure as symbion development]. > > > > Good luck! > > > > On Nov 28, 12:48 pm, Faraz Azhar <[email protected]> wrote: > > > > > Hello > > > > > Im working on VB.NET and im trying to do an automated login in > > > > Facebook. I've tried many ways such as HTTPWebRequest, WebClient, > > > > socket approach, WebBrowser, etc. > > > > > Only the webbrowser turned out to be successful, but that was the > > > > lamest way. I was entering ID and Password directly into the webpage > > > > after it was loaded and then submitting the form. I just want the html > > > > data so webbrowser doesnt fulfill the purpose as the webbrowser starts > > > > loading flash and other scripts and images. In other words im trying > > > > to do screen scraping of facebook. > > > > > The hurdles in this coding is that login into the facebook requires > > > > form submitting AND handling cookies. > > > > > I've made up a code using WebClient. Have a look! > >http://dotnetdevelopment.pastebin.com/m285ff7cd > > > > > My approach has been this way: > > > > 1. First try to open thewww.facebook.com/home.php > > > > 2. Obviously it wont open as we haven't logged in yet. So we will be > > > > redirected to a login page. > > > > 3. I extract the Cookies received thru this response. > > > > 4. I extract the hidden input tags in the HTML submit form. > > > > 5. Finally I will build up a fresh web request and insert the cookies > > > > received above along with the input tags, and of course the user ID > > > > and password. > > > > > Now I *should* be arriving at a plain 2 line web page which says that > > > > login was successful and asks to redirect ourselves to the home page. > > > > *BUT* I am not getting this page. I've tried all possible ways to > > > > achieve this objective but I am failing terribly. Two common errors > > > > that facebook gives is that 'web browser is not cookie enabled' or > > > > 'incompatible browser'. But those issues have been resolved by me. > > > > First one required proper handling of cookies, latter one required > > > > UserAgent header to be set in the request. > > > > > Right now im stuck at nowhere. I try to send the request but facebook > > > > throws me back to the login page without giving any error message. > > > > > Need help! > > > > > PS. My code above includes another function for handling cookies. Its > > > > code is here:http://dotnetdevelopment.pastebin.com/m313ec4b5
