Re: Wxeuphoria network functionality
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Jan 21, 2006
- 462 views
Jason Gade wrote: > > Matt, > > Are the wxeuporia routines for downloading files work yet? > > Could I use wxeuphoria to download an internet file or should I stick with > calling > wget for now? > I've had success with them. I was downloading the Euforum text file and converting it into an rss file. Here is the routine I used to get the file:
procedure on_timer( atom this, atom event_type, atom id, atom event ) atom url, stream integer fn sequence path, current path = get_text_value( file_name ) fn = open( path, "w" ) if fn = -1 then -- error opening the file, should post an error message to the user return end if url = create( wxURL, "http://www.listfilter.com/mlist/current.txt" ) stream = get_url_input( url ) if stream then current = stream_read( stream ) puts( fn, "<?xml version='1.0' encoding='utf-8' ?>\n" ) puts( fn, "<rss version=\"2.0\">\n" ) puts( fn, "<channel>\n") puts( fn, "<title>EuForum</title>\n" ) puts( fn, "<link>http://www.listfilter.com/EuForum</link>\n" ) puts( fn, "<description>EuForum RSS Feed - Official Euphoria Message Board</description>\n" ) to_rss( fn, current ) puts( fn, "</channel>\n</rss>\n" ) delete_instance( stream ) else puts(2, "Stream failed!\n") end if delete_instance( url ) close(fn) end procedure
Matt Lewis