forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reading files stored on the web

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Thu Jul 24, 2008 4:29 pm    Post subject: Reading files stored on the web Reply with quote

Is it possible to simply "open(unit=n,file='http://..." a file stored at a particular web adress and read/write the data as though it was a local file?

Regards

Ian
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Thu Jul 24, 2008 6:26 pm    Post subject: Reply with quote

Probably not but there is a routine called READ_URL@ that should do the trick. It is in the help file.
Back to top
View user's profile Send private message AIM Address
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Fri Jul 25, 2008 8:21 am    Post subject: Reply with quote

Thanks Paul,

I tried adding that but the read_url@ returned ierror=1.

Code below, please specify a url and file of your own that will work.

Thanks

Ian
Code:

winapp
  include <windows.ins>
  character*80 url,file,line
  integer*4    imode,ierror,ios,i,ii
  url  = 'http://.............'
  file = 'c:\temp_file.txt'
  imode=1
  call read_url@(url,file,imode,ierror)
  print *,'ierror=',ierror
  if(ierror .eq. 0)then
    open(unit=10,file=file,status='readonly',iostat=ios)
    if(ios .eq. 0)then
      do i=1,1000
        ii=i
        read(10,1000,end=999,err=888)line
 1000   format(a)
        print *,trim(line)
      enddo
      print *,'Finished            ii=',ii
      stop
 888  continue
      print *,'terminated on error ii=',ii
      stop
 999  continue
      print *,'terminated on end   ii=',ii
      stop
    else
      print *,'ios=',ios
    endif
  endif
  end
Back to top
View user's profile Send private message Send e-mail
DanRRight



Joined: 10 Mar 2008
Posts: 2818
Location: South Pole, Antarctica

PostPosted: Fri Jul 25, 2008 1:10 pm    Post subject: Reply with quote

The read_url works like charm.

I used it for stock trading code almost a half-decade ago for gathering data in real time from several dozen of websites... then was some text manipulation and html parsing and finally displaying all that data in a click on a multi-monitor screen. All done in FTN95 & Clearwin+ only

And often made jokes, that loading data from internet can be done just in one fortran line. Like this (Copyrighted Very Happy ):
Code:
use clrwin;k=0;dowhile(k==0);call READ_URL@('http://forums.silverfrost.com/index.php','res.htm',0,i);call sleep@(10.);enddo;end


Don't use this code on Silverfrost website with small sleep time Smile

One more line will call the browser and display the URL
Where you will find fortran compiler which can do that ???? Very Happy
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 490
Location: Sunderland

PostPosted: Mon Jul 28, 2008 5:01 pm    Post subject: Reply with quote

Dan,

You are right, it works like a dream, even my program did, but it needs to be on a decent machine, unlike the one I tried it on.

The moral of the story is "Don't by a HP/Compaq"

Ian
Back to top
View user's profile Send private message Send e-mail
DanRRight



Joined: 10 Mar 2008
Posts: 2818
Location: South Pole, Antarctica

PostPosted: Tue Jul 29, 2008 12:26 pm    Post subject: Reply with quote

and I think writing several such examples for everyone use would be killing applications. Specifically if all will be done in true Windows fashion using Visual Clearwin like latest SDK for iPhone is working. That is just a dream. And if the next Clearwin will look and make applications like that...
http://au.youtube.com/watch?v=kYgV2GlsufI&feature=related
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group