Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading HTML Code to extract an e-mail address

Status
Not open for further replies.

tonyfitz

Technical User
Mar 25, 2003
13
0
0
IE
Hi,
I am using this code to extract a web page from another web site and display it on my
Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET", " false
objHTTP.Send
Response.Write objHTTP.ResponseText

I want a piece of asp code that will wrap around the HTML code that is extracted to my browser that will read through the HTML code and identify an e-mail address. I then want to output the e-mail address through something like response.write.

This is a web site for an organisation that I am already a member and I am trying to get e-mail addresses of all the members. As a member I am entitled to these e-mail addrresses but they are presented one at a time. I want to automate the collection process. Its all legal.

Regards

Tony
 
Well, basically the result is returned in string format, so what you would want to do is look at the source (or returned) and copy some of the tags preceding the email and following the email. That way you can use InStr on the reult + the length of the substring your searching for and you will have the location for the beginning of the email address. Then do an InStr starting at that location for the following html and you will have the location for the end of the email address. Do a mid based on the first location the second location - first location and you will have your email address.

As far as multiple pages go you will need some way to put this all in a loop and make multiple requests. Basically you will want it to just loop through all the pages that are setup with email addresses you want and have the script extract each one in the loop, possibly adding it to an aray for later use.

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
minilogo.gif alt=tiernok.com
The never-completed website
 
I can manage the rotation through multiple pages fine. Its the identification of the e-mail address on the returned HTML code and extracting it is my problem.

Even if i could identify the entire table that contains the e-mail address I could work with that.

Any ideas as to the code to identify either an e-mail address or a table in the returned code.

regards

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top