Using Win API URLDownloadToFile_()
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
When using URLDownloadToFile API function allows to cache a Web page in a local file for any further parsing or storage.
The problem is that the file is cached through the standard Internet layer of Windows and if the file was previously cached on the local machine it is not reloaded by the URLDownloadToFile function.
URLDownloadToFile_(0, YourURL, YourFile, 0, 0)
DeleteUrlCacheEntry_(YourURL)
is a simple way to force the cache to delete the page's image and to reload it the next time.
This is especially handy for regular pages checks (when accessing dynamic content for example) and make it an easier way rather than using InternetOpen_() InternetOpenFile_() and InterReadFile_() with specific flags for forcing page's reload.
Francois Weil
14, rue Douer
F64100 Bayonne
When using URLDownloadToFile API function allows to cache a Web page in a local file for any further parsing or storage.
The problem is that the file is cached through the standard Internet layer of Windows and if the file was previously cached on the local machine it is not reloaded by the URLDownloadToFile function.
URLDownloadToFile_(0, YourURL, YourFile, 0, 0)
DeleteUrlCacheEntry_(YourURL)
is a simple way to force the cache to delete the page's image and to reload it the next time.
This is especially handy for regular pages checks (when accessing dynamic content for example) and make it an easier way rather than using InternetOpen_() InternetOpenFile_() and InterReadFile_() with specific flags for forcing page's reload.
Francois Weil
14, rue Douer
F64100 Bayonne
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
Thanks Fweil a lot, couse I want to use URLDownloadToFile to download actual serverlists for our sharing-tool. Would be silly to download cached - old - serverlists with dead servers.
But you prevent this problem. hehe
Thanks
Mike
Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
Thanks Fweil a lot, couse I want to use URLDownloadToFile to download actual serverlists for our sharing-tool. Would be silly to download cached - old - serverlists with dead servers.
But you prevent this problem. hehe
Thanks
Mike
Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
IMPORTANT TIP FOR THIS API COMMAND!
The URLDownloadToFile API command is extremely useful, but I just want
to ensure that you all remember this very important tip: Make sure that
your app makes it clear in its docs that it doesn't contain "spyware"
of any kind! Using this API command will set off warning bells in many
firewall apps (such as ZoneAlarm) and the last thing you want to do is
scare off new users of your app who think it's trying to spy on them,
or "phone home", as they say. So make sure you put their concerns to
rest in your docs, and explain why your app is accessing the Internet
before it does so. Trust me on this -- I went through it.
PB - Registered PureBasic Coder
IMPORTANT TIP FOR THIS API COMMAND!
The URLDownloadToFile API command is extremely useful, but I just want
to ensure that you all remember this very important tip: Make sure that
your app makes it clear in its docs that it doesn't contain "spyware"
of any kind! Using this API command will set off warning bells in many
firewall apps (such as ZoneAlarm) and the last thing you want to do is
scare off new users of your app who think it's trying to spy on them,
or "phone home", as they say. So make sure you put their concerns to
rest in your docs, and explain why your app is accessing the Internet
before it does so. Trust me on this -- I went through it.
PB - Registered PureBasic Coder
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fweil.
You are right PB. I always give a networking security notice to customers anyway, even without this specific function. As soon as you use MS stuff, think to give an explicit notice relating too security issues.
Francois Weil
14, rue Douer
F64100 Bayonne
You are right PB. I always give a networking security notice to customers anyway, even without this specific function. As soon as you use MS stuff, think to give an explicit notice relating too security issues.
Francois Weil
14, rue Douer
F64100 Bayonne
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by danny.
I have a problem with DeleteUrlCacheEntry on some XP systems.
I haven't encountered it myself, but the problem seems to occur every once in a while on a client XP machine: I call DeleteUrlCacheEntry prior to calling URLDownloadToFile, in order to ensure that the file will NOT be downloaded from the cache - however sometimes, on XP, it nevertheless comes from the cache, and the user gets an older version than the one on the server.
Any idea?
Thanks!
I have a problem with DeleteUrlCacheEntry on some XP systems.
I haven't encountered it myself, but the problem seems to occur every once in a while on a client XP machine: I call DeleteUrlCacheEntry prior to calling URLDownloadToFile, in order to ensure that the file will NOT be downloaded from the cache - however sometimes, on XP, it nevertheless comes from the cache, and the user gets an older version than the one on the server.
Any idea?
Thanks!
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
berklee: winsock?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Anything. I have an app I have to write that requires cross-platform functionality (think of it as an RSS reader). But the problem seems to be that if I want to download a file from the internet, the mechanics need to be completely different for each OS.
It would be real nice to have some sort of wrapper to handle simple HTTP POST/GET transactions... I'm sure I can figure it out under Windows, but I'd hate to suffer a massive code rewrite to put it under Linux...
I guess this means I'm looking for a cross-platform TCP/IP gadget...
It would be real nice to have some sort of wrapper to handle simple HTTP POST/GET transactions... I'm sure I can figure it out under Windows, but I'd hate to suffer a massive code rewrite to put it under Linux...
I guess this means I'm looking for a cross-platform TCP/IP gadget...