Posts: 1,769
Threads: 410
Joined: Feb 2003
I'm having a devil of a time trying to download a file from site that requires a login. I'm not if the error is my code or if it's something on the server side.
can you help me get this working using the forum's urls?
ClearOutput
str a
Http c.Connect("http://www.quickmacros.com/forum" "my id" "my password")
Http b.GetUrl("http://www.quickmacros.com/forum/profile.php?mode=editprofile" &a)
out a
I'm trying to get text files from our server here, if that makes any difference to the "GetUrl" "GetFile" coding.
Thanks.
Posts: 12,092
Threads: 142
Joined: Dec 2002
Http works like this:
str a
Http c.Connect("www.quickmacros.com" "username" "password")
c.FileGet("forum/profile.php?mode=editprofile" a)
At first, Connect to server, then, using the same variable, call FileGet one or more times. In this case (qm forum), username and password cannot be used here (you must be interactively logged in).
Posts: 331
Threads: 60
Joined: May 2006
im wanting to check to see if a file exists on a web site lets say "http://www.quickmacros.com/test.txt"
also im wanting to download that same file or other files and place them in my c drive
if this can be done can someone please help me
thank you
Posts: 12,092
Threads: 142
Joined: Dec 2002
str s
internet.IntGetFile("http://www.quickmacros.com/test.txt" s)
;ShowText "" s
if(find(s "<TITLE>404 Not Found</TITLE>")>=0)
,out "not found"
else
,s.setfile("$desktop$/test.txt")
Posts: 331
Threads: 60
Joined: May 2006
ok that works great to set the file on my hard drive ..... the if find didnt work, also im wanting to check to see if the file is there before i download it the code that you gave me downloads the file then checks to see if it failed .
thank you
Posts: 12,092
Threads: 142
Joined: Dec 2002
I think you'll have to download at least part of file, say 1KB. Then search for 404 not found. Is it OK?
To check if the file is there without downloading, you must have FTP access (password, etc), and use Ftp functions.
Posts: 1,769
Threads: 410
Joined: Feb 2003
are these valid syntaxes? ie can you use variables with all these?
str dlurl newfln
IntGetFile(dlurl &s)
Dir d.dir(newfln)
run newfln
Posts: 12,092
Threads: 142
Joined: Dec 2002
Quote:can you use variables
Variables can be used with all user-defined functions.