xml - Can someone tell me why I am not getting a response to MSXML2.ServerXMLHTTP.6.0 in classic asp? -
can tell me why not getting response?
<% rssurl = "https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=nrcgov" set xmlhttp = server.createobject("msxml2.serverxmlhttp.6.0") xmlhttp.setproxy 2, "www.proxy.mydomain.com:80" xmlhttp.open "get", rssurl, false xmlhttp.send() myxml = xmlhttp.responsetext myxmlcode = xmlhttp.responsexml.xml response.write(myxml) response.write(myxmlcode) response.write("hey") %> i trying rss feed xml twitter api onto server can manipulate client side code. can tell me why not getting feed code?
success! here problem:
- the reason got question mark was in binary format.
responsetextcauses encoding problem doctype in cross browser (which think why there no styles in chrome , there styles in ie on url itself)- the proxy wasn’t necessary.
- msxml2.serverxmlhttp.6.0 causes encoding error on atom rss feeds.
i used responsebody , microsoft.xmlhttp instead:
url = "https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=myname" 'xmlhttp.setproxy 2, "www.proxy.mydomain.com:80" set objhttp = createobject("microsoft.xmlhttp") objhttp.open "get", url, false objhttp.send rss = binarytostring(objhttp.responsebody) response.write(rss) function binarytostring(byval binary) '--- converts binary content text using adodb stream '--- set return value in case of error binarytostring = "" '--- creates adodb stream dim binarystream set binarystream = createobject("adodb.stream") '--- specify stream type binarystream.type = 1 '--- adtypebinary '--- open stream , write text/string data object binarystream.open binarystream.write binary '--- change stream type text binarystream.position = 0 binarystream.type = 2 '--- adtypetext '--- specify charset source text (unicode) data binarystream.charset = "utf-8" '--- return converted text object binarytostring = binarystream.readtext end function
Comments
Post a Comment