Important alert: (current site time 7/16/2013 12:04:02 AM EDT)
 

VB icon

Stealing Information from Another Web Page (

Email
Submitted on: 4/10/2000 7:07:30 PM
By: Kevin Reay 
Level: Intermediate
User Rating: By 6 Users
Compatibility: ASP (Active Server Pages), VbScript (browser/client side)
Views: 36338
 
     This code steals info/output from other pages! This can be used create meta-searches by grabing the output of other pages!!! For example, you could pass a search string into 2 existing pages and return the results to a single page!
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Stealing Information from Another Web Page (
' Description:This code steals info/output from other pages! This can be used create meta-searches by grabing the output of other pages!!! For example, you could pass a search string into 2 existing pages and return the results to a single page!
' By: Kevin Reay
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6123&lngWId=4'for details.'**************************************

<% Option Explicit %>
<%
Dim url'The URL to download
Dim sInfo 'string to hold the collected info
Dim sHTML 'String to hold HTML from download
Dim rReg 'var to hold regular expression
Dim objCols'Object to hold collections from Regular expression
Dim objMatch 'Object for matches
Dim inet 'Object for Inet Control
url = "WhatEverURL"
'Create instance of Inet Control
Set inet = Server.CreateObject("InetCtls.Inet")
'Set the timeout
inet.RequestTimeOut = 20
'Set the URL property of the control
inet.Url = url
'Actually download the file
sHTML = inet.OpenURL()
'Regular expression to find the string stored between
'the tags. This is where information is.
Set rReg = New regexp
'the TagGoesHere and EndTagGoesHere tags below represent
'the tags surrounding the information we want
'these tags can be more complex if required
rReg.Pattern = "TagGoesHere(.*)EndTagGoesHere"
rReg.Global = False
rReg.IgnoreCase = True
'Execute the regular expression on the raw HTML
Set objCols = rReg.Execute( sHTML )
'Step through our matches
For Each objMatch in objCols
	sInfo = sInfo & objMatch.Value
Next
'Clean up
Set rWorldPop = Nothing
Set objCols = Nothing
'Strip the TagGoesHere tags off of the info
sInfo = Replace(Replace(sInfo, "TagGoesHere", ""), "EndTagGoesHere", "")
%>
<HTML>
<HEAD>
<TITLE>Web output Stealer</TITLE>
</HEAD>
<BODY>
<P>The output of the page is: <%=sInfo %></P>
</BODY>
</HTML>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

4/10/2000 8:16:51 PMMike Stevenson

I'd like to know where I can get this 'InetCtls.Inet' component so that I can actually try this... There is no link to download it.
(If this comment was disrespectful, please report it.)

 
4/10/2000 8:49:20 PMKevin Reay

It should come with win2000 server of Visual Basic. Are you running Win2k Server?
(If this comment was disrespectful, please report it.)

 
4/18/2000 10:45:16 AMTetteh Pecku

We are running Windows NT on our development server. How do I get a hold of the InetCtrls.Inet component? Also, regexp is not a standard object on our server. This does exactly what we need. Any ideas on where I can get the component etc?
(If this comment was disrespectful, please report it.)

 
5/18/2000 2:15:46 PMRio

where I can get 'InetCtls.Inet' component so that I can try this code?
(If this comment was disrespectful, please report it.)

 
8/27/2000 9:51:27 PMFabio A.

Dear,
Author or anyone with information...

I'm new to ASP and i'm currently making a website with meta-search engines.. and since this script gets me the code it is very useful to me... on the same note i have no clue what to do with the above code so if [[[anyone]]] could help me out please give me an email at

[HELOCANE23@aol.com]
Fabio A.

Thanks In Advance For Those of you kind enough to help someone else in need..

Ps. thank you! :)
(If this comment was disrespectful, please report it.)

 
8/28/2000 9:07:48 AMKhawja Ikram

Can u please send me a working example of this code. i tried but unable to grab the content of the site

It display me nothing, except that the output is like this: blah blah

my email address is k_ikram@hotmail.com

Thanx in advance


(If this comment was disrespectful, please report it.)

 
8/28/2000 9:11:17 AMKhawaja Ikram

i am unable to get the information in formated form, i get the pages, but i am unable to understand how to get/extract the information u required from the pages.

e.g: i want to get the query result in my own format from yahoo.com

can anybody send me the sample code using the above techniques

thanx in advance

(If this comment was disrespectful, please report it.)

 
10/31/2000 4:26:41 PMKennster

The author was not kind enough to point people to whatever ActiveX Control he used, where he probably pasted the sample code provided by the control, not realizing it wouldn't work without it. Either way, if you have Internet Explorer 5.0 or greater installed on your server, you can paste the following code into your script, and replace the part where he calls the external activex control with a call to the following function, which will grab the html from the page and return it as a string.
Function HTTPGet(strURL) 'As String
    Dim strReturn ' As String
    Dim objHTTP '  As MSXML.XMLHTTPRequest
    If Len(strURL) Then
		Set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
		objHTTP.open "GET", strURL, False
		objHTTP.send   'Get it.
		strReturn = objHTTP.responseText
    End If
    HTTPGet = strReturn   
End Function

(If this comment was disrespectful, please report it.)

 
8/25/2001 2:21:53 PMAndrew

I like how you destroyed an object that you never ensantiated! (Set rWorldPop = Nothing) When Nathan Pond originally wrote that script, he used it to get the world's population from www.census.gov/cgi-bin/ipc/popclockw
Jeez! If you are going to steal code, at least change the variable names, and don't destroy objects that you never even used!!! If you would like to see the REAL code; http://www.4guysfromrolla.com/webtech/040600-1.shtml

(If this comment was disrespectful, please report it.)

 
12/17/2001 11:04:16 AMMarcio Coelho

Hi Kevin,

You said the tag can me more complex when I need to find what is int it.

My question to you is how more complex ?
Can I pass an Id ?

Please help me and thaks in advance,

Marcio
(If this comment was disrespectful, please report it.)

 
7/3/2002 10:05:49 AMskizmo

I'd like to know where I can get this
'InetCtls.Inet'

press ctrl-t in vb
(If this comment was disrespectful, please report it.)

 
7/9/2002 11:06:09 AMvah

Hello, everybody. Can somebody tell me how to use this kind of code that I wrote earlier on my own to make a real time solution using ASP. I'd like to have a possibility to interrupt this process to restrict the time needed and to put out a result to a user.
I hope, it's clear what I mean.
(If this comment was disrespectful, please report it.)

 
1/2/2004 4:20:14 AM

Hi, Kevin are the code still work. Could you please let me know more about the code because i don't understand it and when i copy the code and run it, it say expected statement required. Sorry to bother you but i really need your help. Thanks
(If this comment was disrespectful, please report it.)

 
1/14/2004 6:36:31 PM

The ocx file for this code should be in the VB6 Runtime package. http://support.microsoft.com/default.aspx?kbid=290887
(If this comment was disrespectful, please report it.)

 
1/14/2004 6:42:33 PM

...if not, just install Visual Basic 6 Pro. It's one of the extra controls you can put on VB forms.
(If this comment was disrespectful, please report it.)

 
4/22/2004 1:36:38 AM

Any source to get the Inet Control???
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.