Log in

View Full Version : ASP parser and recordset



radujit
02-04-2011, 07:59 AM
Hi,
I develop in asp a html page parser, and I would need some help.

Here is my code:

<%
Dim objXmlHttp
Dim strHTML
Set objXmlHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objXmlHttp.open "GET", "http://somepage", False
objXmlHttp.send
strHTML = objXmlHttp.responseText
%>

Everything works fine, and the result is:

<table>
<tr>
<td>EUR</td>
<td>4.23</td>
</tr>
<tr>
<td>USD</td>
<td>4.19</td>
</tr>
<tr>
<td>AUD</td>
<td>4.20</td>
</tr>
<tr>
<td>NEZ</td>
<td>4.13</td>
</tr>
</table>
Now what I need to do is: for EUR and USD only to insert the values into a database. Practically based on tr,td i need that first td in the tr to be the currency and the second td the value and then these to be inserted into a table in the database.

Please help!
Thank you

Dee_Veloper
02-05-2011, 05:55 PM
--replace end-of-line characters with "nothing"

--replace "</td><td>" with ":"

--replace "</td></tr>" with "-"

http://www.w3schools.com/Vbscript/func_replace.asp


--strip off the html with this method

http://www.4guysfromrolla.com/webtech/100199-1.shtml

-- parse/retrieve desired values with split function

http://www.w3schools.com/VBscript/func_split.asp

--add values to database

http://www.w3schools.com/ado/ado_add.asp