ASPTear

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • ASPTear

    Good Morning,
    I have bought myself a book on ASP in order not to have to bug you with my silly questions, but now I am really struggling to get this NumberCells and GetCells function running on my machine (Win 2000 and IIS)
    To put it in a nutshell: I just get error messages! My plan was to build an overview page for stocks that would run locally on my machine.
    Well, I have installed the ASPTear.dll component in WINNT (http://www.alphasierrapapa.com/IisDe...nents/AspTear/). That worked quite well. Then I installed the IIS and it seems to run as well.

    Then I built an ASP -Site by paste and coying your code and saved it in the wwwroot-folder, so it can be published by IIS.
    Then I saved a Webpage by yahoo to my wwwrrot folder and called it Yahoo.asp (I want to test this whole thing first locally, since at home right now I dont have internet access.)
    This is what the page looks like:


    <%
    'extract.asp (c) 2000 Thomas Winningham - use freely!


    Function NumberCells("http://localhost/yahoo.asp")
    'Variables: ExtractUrl: The URL (eg http://www.cnn.com) to number
    'returns a string of the entire HTML document with numbers at the beginning
    'of each cell

    'Use the SOFTWING.AspTear component to get the HTML (but any will do...
    'just rewrite this part)
    'connection is including in Function for purpose of being self-contained
    Const Request_POST = 1
    Const Request_GET = 2

    Set xObj = Server.CreateObject("SOFTWING.AspTear")
    strRetVal = xObj.Retrieve("http://localhost/yahoo.asp",Request_GET,"","","")
    set xobj = nothing

    i = 1 ' HTML Text Location Start
    q = 1 ' Cell Number Start

    ' So long as <TD cells exist- number them
    Do while InStr(i, UCase(strRetVal), "<TD") > 0
    ' find next <TD
    i = InStr(i, UCase(strRetVal), "<TD")

    ' fomd the end of the <TD
    r = InStr(i, strRetVal, ">")
    strRetVal = left(strRetVal, r) & q & _
    right(strRetVal, len(strRetVal) - r)

    'Number the cells: the string equals all the html we've check,
    'our cell number, and then the html we've yet to check
    ' Let the next loop start looking after this <TD tag we found
    i = r + 1

    ' increase the count of which cell we're at
    q = q + 1
    Loop

    NumberCells = strRetVal
    End Function

    Function GetCell(cellnumber, "http/localhost/yahoo.asp")
    'Variables: Cellnumber: Number of the cell to get data from
    'ExtractURL: complete url that contains the cells and data
    'Returns a string of the cells data (including html)

    'Use the SOFTWING.AspTear component to get the HTML (but any
    'will do... just rewrite this part) connection is including in
    'Function for purpose of being self-contained
    Const Request_POST = 1
    Const Request_GET = 2

    Set xObj = Server.CreateObject("SOFTWING.AspTear")
    strRetVal = xObj.Retrieve("http://localhost/yahoo.asp",Request_GET,"","","")
    set xobj = nothing

    i = 1 ' HTML Text Location Start
    q = 1 ' Cell Number Start

    ' Loop until we have processed the cell we're looking for
    Do until q > cellnumber
    ' Look for <TD the start of a cell
    i = InStr(i, UCase(strRetVal), "<TD")

    ' Find the location of the end of the <TD tag
    r = InStr(i, strRetVal, ">")

    ' Let the next loop start looking after this <TD tag we found
    i = r + 1

    ' increase the count of which cell we're at
    q = q + 1
    Loop

    ' The start of our cell text is right after the last found tag
    StartCellText = i

    ' Now... to find the end of this cell's text, we look for either <TABLE
    ' or <TD - whichever comes first (but we have to check if they exist or not)
    ' We don't include nested tables in the cell data because those tables have
    ' cells of their own.
    If (InStr(r, UCase(strRetVal), "<TABLE") > 0) AND _
    (InStr(r, UCase(strRetVal), "<TABLE") < _
    InStr(r, UCase(strRetVal), "</TD>")) then
    ThisCellText = mid(strRetVal, StartCellText, _
    InStr(r, UCase(strRetVal),"<TABLE")- StartCellText )
    Else
    ThisCellText = mid(strRetVal, StartCellText, _
    InStr(r, UCase(strRetVal), "</TD>")- StartCellText )
    End If

    GetCell = ThisCellText
    End Function

    %>


    Well, I hope I inserted the URL´s right?

    Now, everytime I am trying to have my browser test the new ASp-page, I am getting this errormessage:


    Kompilierungsfehler in Microsoft VBScript- Fehler '800a03ea'

    Syntaxfehler

    /iisHelp/common/500-100.asp, line 129

    elseIf (objASPError.Description > "") Then
    ^
    Kompilierungsfehler in Microsoft VBScript- Fehler '800a03f2'

    Bezeichner erwartet

    /final.asp, line 2

    Function NumberCells("http://localhost/yahoo.asp")
    ---------------------^

    Component/WinInet error: Die Anmeldeanforderung wurde verweigert.


    Could you maybe tell me what this means and what I can do so this whole thing will work. This ASpTear Programme is not really clear to me either. It consist out of
    4 parts. one .dll, two .asp´s and one xcel, VB -code. I think that I just need the .dll part, but what about this VB-Code. Will I have to change it and will I have to insert it into the code
    so the programme wil run?

    Here is the link of the tutorial I am referring to
    http://www.4guysfromrolla.com/webtech/031000-1.shtml

    If I want to grab multiple cells from the same site, do I have to rewrite the GetCells Function for every cell I want to get?

    I know that I have loaded you with questions, but you really are my last help. Please let me know if you have any additional questiosn...
    Thanx,
    Jo

    Johannes Weber
Lädt...
X