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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am trying to use ASP to "web clip" information from an URL

Status
Not open for further replies.

rsherry

Programmer
Nov 6, 2000
1
US
I am trying to grab data from 4 different URLs so that PDA users (using ASP/VBScript). I then want to parse the data I grab and place it into a text file. I have tried just about everything. Here is my code, as an example:
<%@ language = VBScript %>
<%
Dim url 'The URL to download
Dim inet 'Object for Inet Control
Dim sHTML 'String to hold HTML from download
Dim rStockSymbol 'var to hold regular expression
Dim objCols 'Object to hold collections from Regular expression
Dim sStockSymbol 'string to hold the stock symbol
Dim objMatch 'Object for matches

url = &quot;
'Create instance of Inet Control
Set inet = Server.CreateObject(&quot;InetCtls.Inet&quot;)

'Set the timeout property
inet.RequestTimeOut = 60
inet.AccessType = 2'icNamedProxy
inet.Proxy = &quot;dbdm.company.com:8080&quot;
inet.Protocol = 4'icHTTP
inet.RemotePort = 80

'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 <b><center>last: tags. This is where the stock symbol is stored.
Set rStockSymbol = New regexp
rStockSymbol.Pattern = &quot;<b><center>(class=&quot;&quot;charthdr&quot;&quot;)</b></center>&quot;
rStockSymbol.Global = False
rStockSymbol.IgnoreCase = True
'Execute the regular expression on the raw HTML
Set objCols = rStockSymbol.Execute( sHTML )

'Step through our matches
For Each objMatch in objCols
sStockSymbol = sStockSymbol & objMatch.Value
Next

'Clean up
Set rStockSymbols = Nothing
Set objCols = Nothing

'Strip the <b><center>last: tags off of the stock symbol
sStockSymbol = Replace(Replace(StockSymbol, &quot;<b><center>last:&quot;, &quot;&quot;), &quot;</b><center>last:&quot;, &quot;&quot;)

%>
<HTML>
<HEAD>
<TITLE>Microsoft Stock Symbol Retrieval</TITLE>
</HEAD>
<BODY>

<P>Here is the Microsoft Stock Symbol: <%=sStockSymbol%></P>

</BODY>
</HTML>

What in the world do I need to do now?
Sherry
Technical Writer/WebMaster/Developer
 
Are you wanting to view pages on a PDA? such as a Palm VII?

DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top