Remote files?

I need to read the contents of 2 files on a remote webserver, for
example: http://www.domain.com/box/text.txt

The first file is a plain-text file and the other is a binary file
(photo).

Text file:
I need to read the text and keep in memory

Binary file:
Basically I just need to move the contents to my own server and store
it in a new file.

Can anyone send me on the right track?

open-uri, net/http

···

On Tue, Mar 25, 2008 at 11:30 AM, <rduby1@gmail.com> wrote:

I need to read the contents of 2 files on a remote webserver, for
example: http://www.domain.com/box/text.txt

The first file is a plain-text file and the other is a binary file
(photo).

Text file:
I need to read the text and keep in memory

Binary file:
Basically I just need to move the contents to my own server and store
it in a new file.

Can anyone send me on the right track?

Take a look at 太阳成集团tyc33455cc✪欢迎莅临
Notice "wb" in _open("fun.jpg", "wb")_, it is important, when you
download images on windows platforms otherwise it will open them in
ASCII mode.

···

On Tue, Mar 25, 2008 at 11:30 AM, <rduby1@gmail.com> wrote:

The first file is a plain-text file and the other is a binary file
(photo).

Hi,

thanks a lot for the answers. It works :slight_smile:

···

On 25 Mar., 13:53, Thomas Wieczorek <wieczo...@googlemail.com> wrote:

On Tue, Mar 25, 2008 at 11:30 AM, <rdu...@gmail.com> wrote:

> The first file is a plain-text file and the other is a binary file
> (photo).

Take a look athttp://www.rubynoob.com/articles/2006/8/21/how-to-download-files-with...
Notice "wb" in _open("fun.jpg", "wb")_, it is important, when you
download images on windows platforms otherwise it will open them in
ASCII mode.