Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Address Book Grabber

0.00/5 (No votes)
27 Feb 2008 1  
Address Book Grabber

I got two ways to grab the address book from any website....

1. By using DownloadData and UploadValues Methods of WebClient Class

The basic algorithm is:

  1. Create WebClient class object to get the methods for sending and receiving data from a resource identified by a URL.
  2. Set the user agent info in the header and set the proxy setting.
  3. Download the login page.
  4. By the Regular Expression, extract the desired name value collection which we have to send with login information, for example, user name, password, etc. to get the address book.
  5. Again, set the header information such as user agent, etc.
  6. Upload the page and get the cookies information.
  7. Download the address book page.
  8. Create the name value collection.
  9. Set the header information such as cookies info, user agent, etc.
  10. Upload the page with name value collection - it will return address book in byte array format.

Please refer to the attached code file: Contact_Importer_.aspx.cs.zip.

2. By using the HTTPWebRequest and HTTPWebResponse HTTP Classes of the .NET Framework

The basic algorithm is:

  1. The first step for getting a web page is to instantiate an HttpWebRequest object. This occurs when invoking the static Create() method of the WebRequest class.
  2. Set request header fields and user credentials.
  3. Get response from the server in stream object and add user credential information with it.
  4. Send further Request by sending cookie within the request.
  5. Again use create() method to open address book page.
  6. Get the response by sending cookie information with the request, it will return address book page in byte array format.

Please refer to the attached code file: Contact_Page_Importer.cs.zip.

History

  • 27th February, 2008: Initial version

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here