Re: format a retrieved text file

Posted: 06-29-2003, 12:17 PM
"John" wrote ...
> I just learned that it is possible to grab a text file from another
> site and display the data on my own site, however when I display the
> data it does not format it correctly. Can anyone please point me in
> the direction of a tutorial or help me with the code below.
Hi John,

I've often wanted to know how to do this also, so cheers for the code, might
come in handy...

With regards to the formatting it looks like its dropped all of the carriage
returns and stuff, just wondered, what would happen if you grabbed the file
from their site and then saved it as a text file on your own - when you open
the text file then, do you still have the correct formatting, or is it being
lost when the XML stuff reads it in?

Robb


Reply With Quote

Responses to "Re: format a retrieved text file"

Robb Meade
Guest
Posts: n/a
 
Re: format a retrieved text file
Posted: 06-29-2003, 12:22 PM
"John" wrote ...

[snip]

Hi John,

In addition to that, I've just tried the same code with the same file and
got what you had...however, I then pointed it to a text file on my own
server...

http://80.195.95.105/xml-get-test.asp

the results came out fine...maybe its something to do with the way that
their text file has been written, maybe there are no carriage returns (is
that possible) in their file?

Try it with some of your own text files and see what happens...as far as the
code goes it 'seems' to be working correctly.

Regards

Robb


Reply With Quote
John
Guest
Posts: n/a
 
format a retrieved text file
Posted: 06-29-2003, 12:22 PM
I just learned that it is possible to grab a text file from another
site and display the data on my own site, however when I display the
data it does not format it correctly. Can anyone please point me in
the direction of a tutorial or help me with the code below.

John

<%
Response.Buffer = True
Dim objXMLHTTP, xml


Set xml = Server.CreateObject("Microsoft.XMLHTTP")

xml.Open "GET",
"http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT", False

xml.Send

Response.Write xml.responseText

Set xml = Nothing
%>

This is a sample of what I am getting back
FZUS61 KCLE 291114 AAA GLFLE LEZ160-291400- OPEN LAKE FORECAST FOR
LAKE ERIE...UPDATED NATIONAL WEATHER SERVICE CLEVELAND OH 700 AM EDT
SUN JUN 29 2003 UPDATED FOR SHOWERS LAKE ERIE FORECAST BEYOND FIVE
NAUTICAL MILES FROM SHORE .SYNOPSIS...A COLD FRONT NORTHWEST OF LAKE
ERIE WILL MOVE SOUTHEAST ACROSS THE LAKE THIS AFTERNOON AND EARLY THIS
EVENING. HIGH PRESSURE 30.10 INCHES OVER THE CENTRAL PLAINS WILL BUILD
ACROSS THE LAKE BEHIND THE FRONT MONDAY AND TUESDAY. THE HIGH WIL

this is what i get if i connect to the page directly (and what I would
like to see with my results

FZUS61 KCLE 291114 AAA
GLFLE
LEZ160-291400-


OPEN LAKE FORECAST FOR LAKE ERIE...UPDATED
NATIONAL WEATHER SERVICE CLEVELAND OH
700 AM EDT SUN JUN 29 2003

UPDATED FOR SHOWERS

LAKE ERIE FORECAST BEYOND FIVE NAUTICAL MILES FROM SHORE

SYNOPSIS
A COLD FRONT NORTHWEST OF LAKE ERIE WILL MOVE SOUTHEAST
ACROSS THE LAKE THIS AFTERNOON AND EARLY THIS EVENING. HIGH
PRESSURE 30.10 INCHES OVER THE CENTRAL PLAINS WILL BUILD ACROSS THE
LAKE BEHIND THE FRONT MONDAY AND TUESDAY. THE HIGH WILL MOVE EAST
OF THE AREA WEDNESDAY BUT SHOULD CONTINUE TO INFLUENCE WEATHER OVER
THE LAKE THROUGH THURSDAY.


Reply With Quote
Robb Meade
Guest
Posts: n/a
 
Re: format a retrieved text file
Posted: 06-29-2003, 12:23 PM
"Robb Meade" wrote ...
> the results came out fine...
correction - it looked like it - but then I changed the contents of the text
file and now it isnt...its definately something to do with the carriage
returns!

Sorry :(


Reply With Quote
John
Guest
Posts: n/a
 
Re: format a retrieved text file
Posted: 06-29-2003, 01:01 PM
It is working now, thanks for the help
http://www.ohioanglers.com/nearshore.asp

Not sure why the <xmp> is showing up at the beginning of the file but
I will mess with it.
Reply With Quote
Evertjan.
Guest
Posts: n/a
 
Re: format a retrieved text file
Posted: 06-29-2003, 01:42 PM
John wrote on 29 jun 2003 in microsoft.public.inetserver.asp.general:
> I just learned that it is possible to grab a text file from another
> site and display the data on my own site, however when I display the
> data it does not format it correctly. Can anyone please point me in
> the direction of a tutorial or help me with the code below.
>
> John
>
> <%
> Response.Buffer = True
> Dim objXMLHTTP, xml
>
>
> Set xml = Server.CreateObject("Microsoft.XMLHTTP")
>
> xml.Open "GET",
> "http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT", False
>
> xml.Send
>
> Response.Write xml.responseText
>
> Set xml = Nothing
> %>
>
<%
Response.Buffer = True
url="http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET",url, False
xml.Send
t=xml.responseText
t=replace(t,vbcr&vbcr,vbcr)
Response.Write "<pre>"&t&"</pre>"
Set xml = Nothing
%>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Reply With Quote
Robb Meade
Guest
Posts: n/a
 
Re: format a retrieved text file
Posted: 06-29-2003, 02:32 PM
"John" wrote..
> With this last piece you posted are you still reading from a text file
> on your local server or reading from the remote url?
Hi John,

I tried it initially with my local txt file, and then changed the code back
to what you'd submitted and added the 2 lines I mentioned- this was then
using your remote file, and it spaced it all out correctly as you wanted
etc.

Robb


Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Format Access memo field? timsilva Coldfusion Database Access 5 09-12-2005 05:38 PM
CFFORM Format Flash not work with IE francois-yanick Coldfusion Flash Integration 2 03-18-2005 07:04 PM
Web format Mac McDougald Adobe Photoshop 7, CS, CS2 & CS3 12 04-06-2004 02:05 AM
What file formats support vector text? Merrily_Schmid@adobeforums.com Adobe Photoshop Mac CS, CS2 & CS3 3 02-11-2004 10:29 PM
Illustrator 10 saving over .ai files as PDF format file Julie_Mullett@adobeforums.com Adobe Illustrator Macintosh 0 02-05-2004 03:01 PM