Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-14-2007, 05:21 PM   PM User | #1
phill_ridout
Regular Coder

 
Join Date: Mar 2006
Posts: 187
Thanks: 5
Thanked 0 Times in 0 Posts
phill_ridout is an unknown quantity at this point
Getting Links from an external page?

http://www.codingforums.com/showthre...525#post544525

My main question is can i read the HTML source from one page in to a varible? If any one has any ideas on how to produce similar asp code to that featured on the link would be great. Any Help Much Appreciated.
phill_ridout is offline   Reply With Quote
Old 03-14-2007, 09:11 PM   PM User | #2
miranda
Senior Coder

 
Join Date: Dec 2002
Location: Arlington, Texas USA
Posts: 1,062
Thanks: 4
Thanked 8 Times in 8 Posts
miranda is an unknown quantity at this point
You could do a screen scrape and get the data using the XMLHTTP object. This would put all of the html into a variable. You will now have to manipulate that variable to get the exact data that you are looking for

Something like this
Code:
<%
Dim xml
Dim page
Dim LinkStart
Dim LinkEnd
Dim hyperLink
Dim intCurrent 
Dim intUsed 
' Create an xmlhttp object:
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
' Opens the connection to the server.
xml.Open "GET", "http://www.somewebsite.com/", False			
' Actually Sends the request and returns the data:
xml.Send
'fills the variable
page = xml.responseText
Set xml = Nothing   'removes the object from server memory
'now all this is left is to parse the variable to get the links out of it
LinkStart = "<a "
LinkEnd = "</a>"

Do until y = true
	If InStr(1,page,LinkStart) <> 0 Then  'ensure there is a link to grab from the page
		intCurrent = Len(page) 
		intUsed = InStr(1,page,LinkEnd)+4
		If (InStr(1,page,LinkStart)) < intUsed Then
			hyperLink = mid(page, InStr(1,page,LinkStart), intUsed - InStr(1,page,LinkStart)) & "<br>"	 
			page = Right(page, (intCurrent-intUsed)) 
		Else 'just in case someone has placed an inadvertant </a> in the page
			page = Right(page, (intCurrent-intUsed))	
		End If
		Response.Write hyperLink & "<br>" & vbCrLF	
	Else
		y = true
	End If
Loop
%>
miranda is offline   Reply With Quote
Old 03-15-2007, 12:35 PM   PM User | #3
SSJ
Regular Coder

 
Join Date: Mar 2007
Posts: 230
Thanks: 0
Thanked 4 Times in 4 Posts
SSJ is an unknown quantity at this point
I have read your both the threads.
You can do this by javascript.

Visit this:
This software helps you..
http://iconico.com/DataExtractor/
__________________
Best Joomla Design Agency India ||PSD to Joomla Template || Award Winning Web Design Company India
SSJ is offline   Reply With Quote
Old 04-18-2007, 03:52 PM   PM User | #4
degsy
Senior Coder

 
Join Date: Nov 2002
Location: North-East, UK
Posts: 1,265
Thanks: 0
Thanked 0 Times in 0 Posts
degsy is on a distinguished road
Quote:
You can do this by javascript.
javascript cannot access external domains.

Quote:
Visit this:
This software helps you..
http://iconico.com/DataExtractor/
That is nothing to do with ASP


With ASP, to grab the page you need xmlHTTP as mentioned above.
http://www.google.co.uk/search?hl=en...mote+url&meta=

To extract HTML you can use Regular Expressions
http://www.4guysfromrolla.com/webtech/120400-1.2.shtml
degsy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:46 AM.


Advertisement
Log in to turn off these ads.