Click to See Complete Forum and Search --> : searching for mailto link
moshe5737
February 18th, 2010, 04:30 PM
hello everyone!
I need to open a web page and search for every <a href="mailto:....
that appears there,copy them to DB
Anyone could help it'd be very appreciative
Thanks
nelo
February 19th, 2010, 03:30 AM
1. Use the HttpWebRequest to request for the page and get the response. Check out MSDN (http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx)
2. Use the response stream to create an XmlDocument. This assumes the web page conforms to XHTML standards otherwise it wont work.
3. Use XPATH to query for 'a' elements with the 'href' attribute. It will give you the data in a node list which can be iterated through and you can use standard ADO.NET to save the data in the database.
If you can't rely on step two then you'll have to search through the data for those tags.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.