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_Authentication_for_Desktop_Applications

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

Reply via email to