remote url asp

Discussion in 'C#' started by red_fiesta, Apr 24, 2007.

  1. #1
    I used this code to grab the page..

    Code:

    <% 
        url = 
    "http://www.svenskfotboll.se/uppland/table.aspx?TournamentId=44851" 
        set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
        xmlhttp.open "GET", url, false 
        xmlhttp.send "" 
        Response.write xmlhttp.responseText 
        set xmlhttp = nothing 
    %>
    Code (markup):


    Shown here http://www2.hemsida.net/sodraupsala/test3.asp

    How now do i just view the data from the table???? (ie the league) and then i can use that code in a page to show the league evert time they update


    Does it have to be an inStr?

    Thanks
     
    red_fiesta, Apr 24, 2007 IP
  2. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #2
    You'll have to parse the <table>...</table> HTML from the rest of the code.

    You'll also have to do this every time there's an update
     
    frankcow, Apr 24, 2007 IP
  3. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Frank any ideas how i can do this?
     
    red_fiesta, Apr 24, 2007 IP
  4. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #4
    frankcow, Apr 24, 2007 IP
  5. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi again,

    Thanks i am trying to use ure function, is there any way of making it so it starts from the strLeft and finishes at strRight cause at the moment it chops off the start and end

    <% 
        url = "http://www.svenskfotboll.se/uppland/table.aspx?TournamentId=44851" 
        set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
        xmlhttp.open "GET", url, false 
        xmlhttp.send "" 
        'Response.write xmlhttp.responseText 
    	dim main_text
    	main_text = xmlhttp.responseText 
        set xmlhttp = nothing 
    	
    
    'response.Write(main_text)
    
    '=== extractor function
    'strSrc=main_text
    'strLeft="<table class=""clTblStandings"""
    '=== strLft: left marker to start at
    'strRgt="</table>"
    '=== strRgt: right marker to end at
    function parser(strSrc, strLft, strRgt)
            dim strParsed
            strLft = cStr(strLft)
           
            if strLft = "1" then '=== start from beginning
                    if inStr(strSrc, strRgt) > 0 then strParsed = left( strSrc, inStr(strSrc, strRgt) - 1)   
            elseif strLft = "" then '=== start from right marker (trim out last result)
                    if inStr(strSrc, strRgt) > 0 then strParsed = right( strSrc, len(strSrc) - (inStr(strSrc, strRgt) + len(strRgt) - 1))
            else
                    if inStr(strSrc, strLft) > 0 then
                            strParsed = right( strSrc, len(strSrc) - (inStr(strSrc, strLft) + len(strLft) - 1))
                            if inStr(strSrc, strRgt) > 0 then strParsed = left( strParsed, inStr(strParsed, strRgt) - 1)
                    end if
            end if
           
            strParsed = trim(strParsed)
           
            do until left(strParsed, 1) <> chr(10) and right(strParsed, 1) <> chr(10)
                    if left(strParsed, 1) = chr(10) then strParsed = right(strParsed, len(strParsed) - 1)
                    if right(strParsed, 1) = chr(10) then strParsed = left(strParsed, len(strParsed) - 1)
            loop
           
            strParsed = replace( strParsed, "%20", " ")
            strParsed = trim(strParsed)
           
            parser = strParsed
    end function
    
    %>
    
    <%=parser(main_text, "<table class=""clTblStandings""", "</table>") %>
    Code (markup):
    shown here


    http://www2.hemsida.net/sodraupsala/test3.asp
     
    red_fiesta, Apr 24, 2007 IP
  6. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #6
    just use markers in front of the <table> tags, or just add them to the parsed code
     
    frankcow, Apr 24, 2007 IP