Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: Using XMLHTTP

  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using XMLHTTP

    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>
    As easy as 3.1415926535897932384626433832795028841

  • #2
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *bump*

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    London & Oxford
    Posts
    97
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by head8k; 02-24-2003 at 03:57 PM.
    As easy as 3.1415926535897932384626433832795028841


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •