Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Strange occurrence using urlmon to download

Author
Message
CumQuaT
AGK Master
9
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Brisbane, Australia
Posted: 26th Aug 2016 02:48
Hi all,

So in my application I use urlmon to return PHP calls using the following function:



However I'm running into an odd problem. If I call the same script twice, it will always return the same value the second time, despite the data being updated on the server (I have a browser open while I run the project to see the MySQL server in real-time). It doesn't matter what the PHP script is, either. The first time the script is run, it will work perfectly and return the correct information. All subsequent times it is run using the above function it will return the same thing from the call, despite the data having changed on the server.

It's not an issue with the PHP script itself, since a) it updates on the server just fine and b) if I close my program and run it again the call will work just fine again (and then fail again on all subsequent executions)

Is there some way to simulate the "dll reset" which would happen upon closing my program and re-opening it again? I would have thought that deleting the DLL would have done it, but apparently not...
CumQuaT
AGK Master
9
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Brisbane, Australia
Posted: 26th Aug 2016 03:33
From what I can tell, the data seems to be caching... Does anyone know of a way to make URLDownloadToFileA not cache?
WickedX
10
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 26th Aug 2016 06:14 Edited at: 26th Aug 2016 06:15
Try the wininet function DeleteUrlCacheEntryA to delete the url cache before calling URLDownloadToFileA.
CumQuaT
AGK Master
9
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Brisbane, Australia
Posted: 26th Aug 2016 06:47
Gave it a try, but no luck, unfortunately

Interestingly, though, I have a new finding.

So I took the PHP call that I'm making in DBP and I copy/pasted it into a Chrome window running at the same time as the project. When the url is called from within the project it does nothing, but when I call it from in Chrome it works fine.

So it seems to be something to do with the project's ability to return a URL response more than one time?
CumQuaT
AGK Master
9
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Brisbane, Australia
Posted: 26th Aug 2016 09:10
Wow, so I resolved it.

It WAS an issue with the PHP. Not with the code, though... The people I use to host my MySQL server upgraded the version of PHP that they use, and my older style code wasn't working properly anymore since the standards have shifted slightly.

Login to post a reply

Server time is: 2019-08-21 01:24:00
Your offset time is: 2019-08-21 01:24:00