How can i get response from remote server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vtp82
    New Member
    • Oct 2007
    • 6

    How can i get response from remote server

    can anybody tell me how can i get response from remote server. I am having problem in getting response from remote server for that I have written following script.

    But its not showing values in the teble.
    Code:
    <%
    Response.Write("<SPAN class='tt'>Corn Futures (CZ)</SPAN>")
    Const REMOTE_FILE_URL="http://www.cmegroup.com/trading/commodities/grain-and-oilseed/corn_quotes_globex.html"
    
    Call ShowRemoteFile
    
    Sub ShowRemoteFile
    Dim objXML, strContents, arrLines
    Dim x
    Set objXML=Server.CreateObject("Microsoft.XMLHTTP")
    
    'read text file...
    objXML.Open "GET", REMOTE_FILE_URL, False
    
    objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    
    objXML.Send
    strContents=objXML.ResponseText
    
    Set objXML=Nothing
    
    'split into lines and read line by line...
    arrLines=Split(strContents, VBCrLf)
    For x=0 To UBound(arrLines)
    If InStr(arrLines(x), "<Table>") or InStr(arrLines(x), "<th") or InStr(arrLines(x), "<tr") Then
    If not InStr(arrLines(x),"<i>") Then
    'If InStr(arrLines(x), "<Table>") or InStr(arrLines(x), "<tr>") or InStr(arrLines(x), "<td>") or InStr(arrLines(x), "xmlns:xs") Then
    Response.Write(arrLines(x)&"<br />")
    'End If
    End If
    End If
    Next
    End Sub
    %>
    Last edited by jhardman; Jan 8 '10, 04:57 PM. Reason: added code tags
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Your code works, the problem is that the website you are using is designed for a human audience, it first generates the table with only dashes, then puts all the data in it in a second step. Your code pulls up the correct table, but doesn't get the data updates. You need to find a webservice or something similar that has the data you need and is designed to be accessed programatically .

    Jared

    Comment

    Working...