...

View Full Version : Using XMLHTTP



head8k
02-21-2003, 04:23 PM
I am having problems fetching some XML from a remote server using XMLHTTP. The code below works fine and will grab the source code from google and make a local copy, the problem lies when I put in the real URL I want to grab: http://diveintomark.org/xml/fosnews.php.

I know that the problems are being caused by non-ASCII characters in the response text but how can I get around this?

<html>
<head>
<title>XMLHTTP Example</title>
</head>
<body>

<%
dim http, fso, localfile

set http = Server.CreateObject("Microsoft.XMLHTTP")
http.Open "GET", "http://www.google.com", false
http.SetRequestHeader "Content-type", "text/html"
http.Send

set fso = Server.CreateObject("Scripting.FileSystemObject")
set localfile = fso.CreateTextFile(Server.MapPath("journals.xml"), True)
localfile.writeLine http.responseText
set fso = nothing
set http = nothing
%>

</body>
</html>

head8k
02-24-2003, 11:39 AM
*bump*

raf
02-24-2003, 12:24 PM
I know that the problems are being caused by non-ASCII characters in the response text but how can I get around this?

Can you clarify this some more ? What characters?

If i understand correct, you can store the code in your xml-file but can't display it properly.

head8k
02-24-2003, 03:55 PM
I can response.write the text to the screen because then the parser will automatically translate the bad characters to an acceptable charset. The problem happens when I try and save the response text to a file using the file system object. I know you can create unicode files with the f.s.o. but that doesn't help, I need to create an ASCII file with the non-ASCII characters translated into ASCII.

The above example should work if you want to see what I mean.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum