W
Whodat
I have parsed some data from another website, and I would like to save the
data to a file so that I can link it to an access db.
The data is in an array and I cant seem to find the right code to get it to
save?
Here is what I have:
<%
Set ObjHttp = Server.CreateObject("Msxml2.XMLHTTP")
objHttp.Open "GET",
"http://www.tsn.ca/nba/Statistics.as...season=2005&type=player&endRow=520&startRow=1",
false
objHttp.Send
MyHTML = objHttp.ResponseText
Set objHttp = Nothing
MyVar = MID(MyHTML, instr(1, MyHTML, "bgcolor=""#F7EDE0""")-32, LEN(MyHTML))
MyVar = MID(MyVar, 1, instr(1, MyVar, "</table>")-1)
Dim myArray(17)
Dim ii 'col count
Do While instr(1, MyVar, "<tr") > 0
'// Now extract the 'record' from the table (like above code)
MyRec = MID(MyVar, instr(1, MyVar, ">")+1)
MyRec = MID(MyRec, 1, instr(1, MyRec, "</tr>")-1)
'// Now we should be left with all the <td>'s
ii = 0
Do while instr(1, MyRec, "<td") > 0
myValue = MID(MyRec, instr(1, MyRec, ">")+1)
myValue = MID(myValue, 1, instr(1, myValue, "</td>")-1)
'// We have successfully got a value from a <td>!
'// Maybe at this point you could load it into an array:
myArray(ii) = myValue
'// Now we have to clean the MyRec string up
MyRec = MID(myRec, instr(1, myRec, "</td>")+5)
ii = ii + 1
Loop
'Here it is just dumped to the page, I would like to save it to a file...
response.Write Join(myarray,",") & "<br>"
'// Now we have to trim up the main string
Myvar = MID(MyVar, instr(1, MyVar, "</tr>")+5)
Loop
%>
Thanks for reading
data to a file so that I can link it to an access db.
The data is in an array and I cant seem to find the right code to get it to
save?
Here is what I have:
<%
Set ObjHttp = Server.CreateObject("Msxml2.XMLHTTP")
objHttp.Open "GET",
"http://www.tsn.ca/nba/Statistics.as...season=2005&type=player&endRow=520&startRow=1",
false
objHttp.Send
MyHTML = objHttp.ResponseText
Set objHttp = Nothing
MyVar = MID(MyHTML, instr(1, MyHTML, "bgcolor=""#F7EDE0""")-32, LEN(MyHTML))
MyVar = MID(MyVar, 1, instr(1, MyVar, "</table>")-1)
Dim myArray(17)
Dim ii 'col count
Do While instr(1, MyVar, "<tr") > 0
'// Now extract the 'record' from the table (like above code)
MyRec = MID(MyVar, instr(1, MyVar, ">")+1)
MyRec = MID(MyRec, 1, instr(1, MyRec, "</tr>")-1)
'// Now we should be left with all the <td>'s
ii = 0
Do while instr(1, MyRec, "<td") > 0
myValue = MID(MyRec, instr(1, MyRec, ">")+1)
myValue = MID(myValue, 1, instr(1, myValue, "</td>")-1)
'// We have successfully got a value from a <td>!
'// Maybe at this point you could load it into an array:
myArray(ii) = myValue
'// Now we have to clean the MyRec string up
MyRec = MID(myRec, instr(1, myRec, "</td>")+5)
ii = ii + 1
Loop
'Here it is just dumped to the page, I would like to save it to a file...
response.Write Join(myarray,",") & "<br>"
'// Now we have to trim up the main string
Myvar = MID(MyVar, instr(1, MyVar, "</tr>")+5)
Loop
%>
Thanks for reading