|
-
May 1st, 2006, 02:05 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Help me open a file on the internet!
I wrote some code for checking if it can read a file that i have on my website. The file that the program is supposed to try to open is www.guitar.gratisplaneten.com/test.txt.
Why can't my program open the file? Is there some other way of doing this?
Here's the code of the function:
Function connected(hej)
On Error GoTo notconnected
Open "http://www.guitar.gratisplaneten.com/test.txt" For Input As #9
Close #9
Exit Function
notconnected:
If (MsgBox("The program cannot connect to the internet, check your internet and firewall settings and try again. To try again, press OK.", vbOKCancel, "No connection")) = vbOK Then
connected (1)
End If
End
End Function
-
May 1st, 2006, 02:47 AM
#2
Fanatic Member
Re: Help me open a file on the internet!
Hi cyber_alex
You can't just open a file off the internet, you will need to download it first.
Use the Inet control or a webbrowser to download the text file onto your computer, and then read it from there.
-
May 1st, 2006, 02:49 AM
#3
Thread Starter
Addicted Member
Re: Help me open a file on the internet!
but how do I then write a file to my website?
-
May 1st, 2006, 02:50 AM
#4
Thread Starter
Addicted Member
Re: Help me open a file on the internet!
and why can't I just open a file from my site, the internet browser can.
-
May 1st, 2006, 03:01 AM
#5
Fanatic Member
Re: Help me open a file on the internet!
Because your program isn't a internet browser!
If your website supports FTP then you can use the Inet control to upload a file to your website and download it
-
May 1st, 2006, 03:03 AM
#6
Thread Starter
Addicted Member
Re: Help me open a file on the internet!
-
May 1st, 2006, 03:07 AM
#7
Fanatic Member
Re: Help me open a file on the internet!
Click Project > Components > 'Microsoft Internet Transfer Control' > OK
Add the Inet control (which should be in the toolbox now) to your form.
When you want to download the data use
VB Code:
HTML = Inet1.OpenURL("http://www.guitar.gratisplaneten.com/test.txt")
-
May 1st, 2006, 03:14 AM
#8
Thread Starter
Addicted Member
Re: Help me open a file on the internet!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|