Chat on IRC |
inet api
Posted by sinple [send private reply] at January 09, 2003, 08:07:48 AM
k hi all
vb: i need some api to download a file from a location on the web without using ftp. it'll proably end up just being text files. that are saved to hdd and inputted just little alterrations i can make to a finished product without having to redistribute. i'm not interested in an any auto pdate wizard or anything, this will fit nicely so if some could help me out here, that'd be great.
Posted by gian [send private reply] at January 09, 2003, 10:09:33 PM
Why do you need an API? Opening a connection to a server and depending on sophisticated you wish to be, could just send a simple HTTP request for the file.
Posted by D_Dave [send private reply] at January 10, 2003, 02:09:47 PM
use the i-net control: Project-->Components-->Microsoft Internet Transfer Control-->(Check box)-->Apply
[Code] Dim sURL As String Dim bData() As Byte Din intfile as Integer sURL = "http://www.site.com/file.txt" intfile = FreeFile() bData() = Inet1.OpenURL(sURL, icByteArray) Open App.Path & "file.txt" For Binary Access Write As #intfile Put #intfile, , bData() Close #intfile [/code] That should work... (you did say vb didnt you?) Dave
Posted by sinple [send private reply] at January 13, 2003, 09:30:01 AM
k thats cool
i DO NOT want to use an activeX control that is not in the 'basic' set (eg. the same chunk as the command button, label, textbox etc.) i want an APi because it doesn't need a inet control GIAN: how do send a http request??
Posted by CViper [send private reply] at January 13, 2003, 11:25:45 AM
just send GET <insert file-path here> HTTP/1.0<crlf> Host: <remote host name><crlf> <crlf><crlf> to a http server on port 80. Although there might be a few more "fields" you have to send - my memory is failing on this stuff :)
Posted by Psion [send private reply] at January 13, 2003, 02:53:20 PM
I think you want 1.1, not 1.0.
Posted by pramod [send private reply] at January 15, 2003, 12:49:45 PM
* VB [As far as I know] doesn't have any TCP/IP Implementation built into it. This means you definitely need an ActiveX control or a dll or something.
* If have to use a dll, why not use an activex control? * The only way you can avoid this is by connecting using the windows API directly. This'll mean doing something like createSocket, send and whatever. I did this a long time ago in Java but its quite a lot of code [much much more than Dave's File Transfer Control thingy] * If you still want to use the API, it'll probably mean writing C Code that talks to the API [very bad]. Then converting that C Code to VB [even worse]. If you're sure you want to do something of this kind, my recommendation is write an MFC Dll to get the file for you and then call the dll from VB.
Posted by taubz [send private reply] at January 15, 2003, 01:45:54 PM
Using the winsock API from VB (without C) should be easily possible.
Register as a new user | ||||||||||