View Full Version : read content from remote site
charon
11-29-2002, 10:12 AM
hi,
I need to update our web-site on the company's share value daily, would it be possible for me to auto update the value by read the content (only share value) from "the web-site" (remotely)???
for instance, go to http://biz.thestar.com.my/marketwatch/bizmain.asp?closingprice=7
Just assume that i need to update the Counter AM value base on the Open Day High Day Low Last Change % Change Vol
How do I make my web-page auto update the value by reading the value from the site (remotely). Now I do it manually.
Please advice!
Sintsof
11-30-2002, 10:25 AM
<%
Set xObj = Server.CreateObject("SOFTWING.ASPTear")
On Error Resume Next
strURL = "http://www.yoururl.com"
strResult = xObj.Retrieve(strULR,Request_POST,"test=it","","")
Response.write strResults
%>
I hope this can help you.
whammy
12-01-2002, 01:37 AM
What was posted above is a third-party component.
http://www.alphasierrapapa.com/IisDev/Components/AspTear/
Haven't tried it, but it looks like it nabs the whole page from another server... in which case you'll end up having to parse it out...:eek:
... but I suspect something like this would probably be fairly easy to do instead the remote server was using an XML Web Service... I'm just learning about them right now though, so I'm still no expert. ;)
In a month or so I might be able to explain this pretty well though, hopefully...
charon
02-21-2003, 10:29 AM
hi whammy, come back again for this topic...
due to I have already completed some of the important task, so now gonna come back this topic, hope can gain something.
I know that there are fews number of components that we can be use for extracting data from remote sites. I'm trying to use MS Internet Transfer control or XMLHTTP together with string function to grab the "data" i want, but still fail to get it.
The data i want is kind of dynamic.I'm try to use regexp, but hve problem in matching character, always invalid. the data i want is look like:
<TR ALIGN=RIGHT>
<TD ALIGN=LEFT><a href="/marketwatch/charts/chartlist.asp?stock_code=1224~INTRIA&p1=2.38&p2=2.39&p3=2.4&p4=2.39&p5=2.4&p6=0.02&p7=0.84&p8=67&p9=13.433">SPSETIA</A></TD><TD ALIGN=LEFT>8664</TD><TD>2.39</TD><TD>2.40</TD><TD>2.39</TD><TD>2.40</TD><TD><FONT COLOR=#0000FF>0.02</FONT></TD><TD>0.8%</TD><TD>67</TD><TD>2.40/6</TD><TD>2.41/17</TD></TR>
the static part is :
Start:
TR ALIGN=RIGHT>
<TD ALIGN=LEFT><a href="/marketwatch/charts/chartlist.asp?stock_code=1224~INTRIA
End Part is:
</TD></TR>
Please advice!
Leeus
02-21-2003, 12:38 PM
Its all a bit daunting at first, use this, needs no extra components, just IIS. And the XML parser which all good ISP's have installed!
It has been tweaked a little for no response etc.
Function GetHTML(strURL)
Dim objXMLHTTP, strReturn
'Old Version
'Set objXMLHTTP = Server.CreateObject("Microsoft.XMLHTTP")
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", strURL, true
call objXMLHTTP.Send()
If objXMLHTTP.readyState <> 4 then
objXMLHTTP.waitForResponse 3
End If
If (objXMLHTTP.readyState <> 4) Or (objXMLHTTP.Status <> 200) Then
'Abort the objXMLHTTPHttp request
objXMLHTTP.Abort
strReturn = "Could not retrieve webpage....."
Else
strReturn = objXMLHTTP.ResponseText
End If
'strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function
charon
02-22-2003, 01:12 AM
hi,
But this is not what I want, the function will extracte the whole data, what I want is certain part of the data.
oracleguy
02-22-2003, 01:32 AM
Then you'll need to modify it to parse the returned value.
I did something like this a week ago, I wrote a VB program that notifies users when the site I was working on had a new news item.
I however was able to surround the first new article in with: <!--FIRSTNEWS --> and <!-- LASTNEWS --> and I used those to be able to shed the rest of the data off.
Also you mentioned the MS Internet Transfer Control, just FYI, until they released version 6.0.88.62 (aka SP5 for VS6) there was a bug that wouldnt return the entire file that you requested.
charon
02-22-2003, 01:44 AM
The problem is I have no idea how to use the string functions to "grab" the data I want.
charon
02-22-2003, 04:02 AM
I have alreday Solved the Problem myself. Thanks a lot.
vBulletin® v3.8.2, Copyright ©2000-2010, Jelsoft Enterprises Ltd.