By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,126 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,126 IT Pros & Developers. It's quick & easy.

Problem in getting response from remote server

P: 1
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 :
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Response.Write("<SPAN class='tt'>Corn Futures (CZ)</SPAN>")
  3. Const REMOTE_FILE_URL="http://www.cmegroup.com/trading/commodities/grain-and-oilseed/corn_quotes_globex.html"
  4.  
  5. Call ShowRemoteFile
  6.  
  7. Sub ShowRemoteFile
  8.     Dim objXML, strContents, arrLines
  9.     Dim x
  10.     Set objXML=Server.CreateObject("Microsoft.XMLHTTP")
  11.  
  12.     'read text file...
  13.     objXML.Open "GET", REMOTE_FILE_URL, False
  14.  
  15.     objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  16.  
  17.     objXML.Send
  18.     strContents=objXML.ResponseText
  19.  
  20.     Set objXML=Nothing
  21.  
  22.     'split into lines and read line by line...
  23.     arrLines=Split(strContents, VBCrLf)
  24.     For x=0 To UBound(arrLines)
  25.         If InStr(arrLines(x), "<Table>") or InStr(arrLines(x), "<th") or InStr(arrLines(x), "<tr") Then
  26.             If not InStr(arrLines(x),"<i>") Then
  27.             'If InStr(arrLines(x), "<Table>") or InStr(arrLines(x), "<tr>") or InStr(arrLines(x), "<td>") or InStr(arrLines(x), "xmlns:xs") Then
  28.                 Response.Write(arrLines(x)&"<br />")
  29.             'End If
  30.             End If
  31.         End If
  32.     Next
  33. End Sub
  34. %>
Jan 8 '10 #1
Share this Question
Share on Google+
3 Replies


jhardman
Expert 2.5K+
P: 3,405
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
Jan 8 '10 #2

P: 6
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.
Jan 9 '10 #3

P: 6
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.
Jan 9 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.