Saving array to a file

Discussion in 'ASP General' started by Whodat, Nov 25, 2004.

  1. Whodat

    Whodat Guest

    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.asp?category=Points&position=&division=&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
    Whodat, Nov 25, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Kandell
    Replies:
    4
    Views:
    4,140
    eeebop
    Dec 10, 2004
  2. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,489
    Luis Esteban Valencia
    Jan 6, 2005
  3. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    192
    Curt_C [MVP]
    Oct 3, 2003
  4. Yvon Thoraval
    Replies:
    5
    Views:
    198
    Jason Creighton
    Sep 17, 2003
  5. Ana Dionísio

    Scan CSV file and saving it into an array

    Ana Dionísio, Apr 25, 2013, in forum: Python
    Replies:
    2
    Views:
    204
    Oscar Benjamin
    Apr 25, 2013
Loading...

Share This Page