Getting a file from an url

Hell,

I look for how to get a file from an url (.pdf, .doc, or other) in lotusscript.

What I want to do is from an url that I know (for example: http://www.yyyy.com/file.pdf), I get this file “file.pdf” and I save it in a richtext item of a notes document.

About “save in a richtext item”, no problem, I know how to do, but I don’t know how to get the file from an url…

Someone knows how to do and could help me please ?

Thanks !

Subject: You could adapt this

Here’s a VBScript that does what you want. You could put this into a LotusScript agent then top and tail it with some code to add the file to a NotesRichTextItem

http://www.paulsadowski.com/wsh/getremotebinaryfile.htm

Subject: I can’t do what I want

Yes, it’s a good idea but I can’t to adapt it…Set xml = CreateObject(“Microsoft.XMLHTTP”)

xml.Open "GET", URL, False

xml.Send

obj = xml.responseText

But after I don’t know how to copy this obj on a local folder…

Subject: For starters…

…use the actual code given. Note that it uses responseBody, not responseText. And it saves the binary data somewhere.

I tried the code as given (using appropriate paths and a sample PDF on our intranet) but it crashed out on trying to save the responseBody with “Array size exceeds maximum limit”, probably because the file was too big for LotusScript. So you could try keeping the file as a VbScript, using Shell to call it via cscript.exe, then adding the file that it creates to a NotesRichTextItem

Subject: Re: Getting a file from an url

Develop Java Agent using Java XMLHTTP Object.

You can search in google for java XMLHTTP sample code, you will find lot of examples.

Good luck