Problem in getting response from remote server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vtpvp82
    New Member
    • Jan 2010
    • 1

    Problem in getting response from remote server

    I am having problem in getting response from remote server for that I have written following script response got correctly but the data on the page is not displayed it gives “–“ in place of grid data. It’s because when actual page load in web browser it shows “-“ until loading is not completed after that it gives actual value after successful completion of loading of the page.

    Script I have written is as follows :
    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, 02:56 PM. Reason: addes code tags
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    It looks to me like you need to find a better data source. The website you are pulling from is designed for human browsers, you need to find a webservice or some such. I think after you find a better source there will be no problem.
    Jared

    Comment

    • vtp82
      New Member
      • Oct 2007
      • 6

      #3
      First of all Thanks for your reply.
      And is there any datasource which pools data from anther server rather then getting response and store into the string ? exactly what i want is the HTML Table object like DomElement from that page and display it on to my page.

      Comment

      • vtp82
        New Member
        • Oct 2007
        • 6

        #4
        First of all Thanks for your reply.
        And is there any datasource which pools data from anther server rather then getting response and store into the string ? exactly what i want is the HTML Table object like DomElement from that page and display it on to my page.

        Comment

        Working...