Hi i have been trying to get the contents from a webpage using MSXML2.ServerXMLHTTP . Although i had done the same in past without any issues.. but now while get a content from a page , i am getting no response.text . Have checked the status it says 200. Seems like the problem is due to character encoding . Below the is the page in question http://indiacode.nic.in/qrydisp.asp?tfnm=188712 &tfnm2=1 Code i am using is <% strUrl="http://indiacode.nic.in/qrydisp.asp?tfnm=188712%20&tfnm2=1" Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP") xmlHttp.Open "GET", strUrl, False xmlHttp.setRequestHeader "User-Agent", "asp httprequest" xmlhttp.setRequestHeader "Content-type", "text/xml; charset=utf-16" xmlHttp.Send getHTML = xmlHttp.responseText xmlHttp.abort() set xmlHttp = Nothing response.write getHTML %> Can u please guide me how to get the contents..
try this <% url = "http://*****" set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open "GET", url, false xmlhttp.send "" Response.write xmlhttp.responseText set xmlhttp = nothing %> ps: not sure MSXML2 works for all hosts
Hi Seems like the code which you had given is quite similar to what i had used except the requestheader thing.. Anyways .. i had tried it again.. but the same problem .. i am getting no result. the output is blank
I just tried the code and it was function well. As I noted. Maybe your host does not support MSXML V2.X or too many errors appeared and need to be clean at host server. Ask your host support. To make sure.
For time being . .i am trying this code on my local comp .. I am able to get data from other pages.. but this particular pages is giving me fever .. Have even tried using the following .. but still no success "xmlhttp.setRequestHeader "Content-type", "text/HTML; charset=utf-8" "
If you are focusing on the URL you provided. I do checked but only can get "indiacode.nic.in" home page info and can not get info from "indiacode.nic.in/****" It may because the site block all XMLHTTP from the 3rd paty. Take a look Google search by [ site:indiacode.nic.in ] the site may also block G bots. I think it is not the code problem.
i dont think thier is any issue of not allowing XMLHTTP I tried google search .. and found that the results are appearing in google search check this link http://www.google.co.in/search?hl=e...ndiacode.nic.in/qrydisp.asp&btnG=Search&meta= And also i tried using Php Curl .. and CURL was working fine.. May be some header issue is thier.. but excatly what .. i can't say :-( Once again thanks for your time..
Hi I finally got the solution.. here is the tweak.. just replaced getHTML = xmlHttp.responseText Code (markup): with getHTML = xmlHttp.ResponseBody Code (markup): Thanks for replying wacamoi Regards Suraj jain
Good to hear that Suraj jain it is also nice that you are willing to share the solution not many people will do like you Thank you too. Best Reagrds, Wacamoi