|
Post by (X) on Nov 23, 2023 19:26:48 GMT 1
So, it occured to me to write a simple GFA_BASIC 32 for Windows Library to download a file from a URL: "Lib_URLDownloadToFile.G32".
In the future it would be simple to add this library to a new or existing program "as you do" to make programming life a little easier.
I am troubleshooting this code. I will post a stable version asap.
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 23, 2023 20:41:02 GMT 1
Here is the library source code which you will need to compile and store in your favourite Lib section. ... Will "Lib_URLDownloadToFile.G32" work in Win7 also for "https://"?
|
|
|
Post by Roger Cabo on Nov 23, 2023 21:07:05 GMT 1
Here is the library source code which you will need to compile and store in your favorite Lib section. ... Will "Lib_URLDownloadToFile.G32" work in Win7 also for "https://"? This works with windows7. There is a general problem, because if the website ask for a cookie, then it doesn't work because now idea how to react on this user input.
If you want to grab anything on a customer machine, because you share you gb32.exe, you got into problems because you never know if your customer have an iNet connection. Or he has no Webbrowser installed on his machine, and if he has cookies enabled or not. If not, you never get any connection or data from this particular site.
But there is a complex solution: If you want to grab data on any customer machine from gb32, you need an own Webserver. Your well configured web server is able to access all websites automatically with a crown job by php and would be able to login or use cookies also!!!
#1) Then your GB32 exe is able to access your web server and download the required data.
#2) It's also possible to send a data package to your web server, that contains commands whatever the web server should do. Then you can grab the result. Example: Send a package with instructions to you web sever, contains: login to website www.google.com with NAME/PW. (eg http://www.chatgpt.com) The instructions can include: Click on "New Chat" input question "How I become a millionaire in 10 minutes" Then you grab the website result and display to the customer. I personally have no idea to configure a web server, but I learned all by ChatGPT 4.0. If you highly encrypt the data package, you can use a simple "insecure" FTP connection by FTP32 GB32 supports. If you know whats important and set the corrects flags, you can public the login data but none can grab any data or uncover anything. That's really amazing.
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 23, 2023 23:12:36 GMT 1
I've also always used the routine via "urlmon" for my programs, so the new one was nothing new!
But, I fixed the problem and Win7 was probably not the problem. However, I had to change the website to get the sunrise and sunset in Frankfurt. With the previous website, our routine threw an error. Here, feel free to try it yourself:
URL$ = "https://sonnenuntergang-zeit.de"
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 24, 2023 15:09:53 GMT 1
Not a file, but that doesn't matter. You can usually also download a single page on the web, e.g. "https://Google.com". Just give it a try and you will see. The problem with this website I mentioned is that no page can be downloaded from there without errors. And: I have another website for the times for sunset/sunrise, this is not the problem at the moment.
|
|
|
Post by Roger Cabo on Nov 25, 2023 15:55:23 GMT 1
Not a file, but that doesn't matter. You can usually also download a single page on the web, e.g. "https://Google.com". Just give it a try and you will see. The problem with this website I mentioned is that no page can be downloaded from there without errors. And: I have another website for the times for sunset/sunrise, this is not the problem at the moment.
url = "https://www.google.de/search?q=Gfabasic+Forum" This is the result.. a.html (24.94 KB) If you're not logged in and without cookies you never get any results vom google with urlmon without postdata. If yes, show us how plz!
|
|
|
Post by Roger Cabo on Nov 25, 2023 18:29:54 GMT 1
perhaps this helps if the website is created by a php or asp code. Like "https://gb32.proboards.com/attachment/download/1999" and redirecting into a download. gb32.proboards.com/post/2581/thread
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 26, 2023 17:47:11 GMT 1
It's about this page: sonnenuntergang-zeit.deOnly about this page: sonnenuntergang-zeit.deNone other than this page: sonnenuntergang-zeit.deCall it via your 'URLDownloadToFile' routine and you will get an error return -2146697211 and not a single byte of content in the saved file! That was my last point. Try it out first to see what happens. Then feel free to comment. At first I thought it was because of my code, that there were no more content bytes, but my routine had been working perfectly for many years with exactly this web page. Only the subpage changed to "https://sonnenuntergang-zeit.de/sonnenuntergang:frankfurt-am-main:heute.html", but the whole website didn't work with our 'URLDownloadToFile'. Then I thought it was due to changing the site to https and Win7. Then I realized it was also affecting fresh Win10. Meaning now: I don't know if the web page is returning a wrong return value or not. Or if 'URLDownloadToFile' is actually buggy. Therefore again: Please just try it out first! Our 'URLDownloadToFile' returns an error -2146697211 as a long return value and no content and therefore no file is created. That's what it's all about now! I have written this in German to make it clear: It's only about this error on this website. I now get my sunset/sundown-times from one of these thousands of other sites that exist for this, so it's no longer my problem! ----------In Deutsch ----------
Nur um diese Seite: sonnenuntergang-zeit.deUm keine andere als diese Seite: sonnenuntergang-zeit.deRuft sie über eure 'URLDownloadToFile'-Routine auf und ihr bekommt einen Fehler als Return zurück und in der gespeicherten Datei kein einziges Byte Inhalt! Nur darum ging es mir zuletzt. Probiert es erst aus, damit ihr seht, was überhaupt passiert. Dann kommentiert gerne weiter. Anfangs dachte ich, es läge an meinem Code, dass da keine Inhaltsbytes mehr kamen, aber meine Routine funktionierte schon viele Jahre mit genau dieser Web-Seite perfekt. Lediglich die Unterseite änderte sich auf "https://sonnenuntergang-zeit.de/sonnenuntergang:frankfurt-am-main:heute.html", aber die ganze komplette Webseite funktioniert nicht mit unserer 'URLDownloadToFile'. Dann dachte ich, es läge an der Veränderung der Seite auf https und Win7. Dann merkte ich, dass es auch frisches Win10 betraf.
Bedeutet jetzt: ich weiß nicht, ob die Webseite einen falschen Return-Wert zurückliefert oder nicht. Oder ob 'URLDownloadToFile' eigentlich buggy ist. Daher nochmal: Probiert es bitte einfach erst aus! Unsere 'URLDownloadToFile' liefert einen Fehler -2146697211 als long-Return-Wert und eben keinerlei Inhalt zurück und es wird somit auch keine Datei erzeugt. Darum geht es jetzt und nur darum! Ich habe das jetzt extra auch mal in Deutsch geschrieben, um deutlich zu machen: Es geht nur um diesen Fehler bei dieser Webseite und unserer Funktion 'URLDownloadToFile'. Meine Tageszeiten hole ich mittlerweile über eine der zig-tausend anderen Seiten, die es dafür gibt, daher ist das nicht mehr mein Problem!
|
|
|
Post by Roger Cabo on Nov 26, 2023 23:37:13 GMT 1
It's about this page: sonnenuntergang-zeit.deOnly about this page: sonnenuntergang-zeit.deNone other than this page: sonnenuntergang-zeit.deCall it via your 'URLDownloadToFile' routine and you will get an error return -2146697211 and not a single byte of content in the saved file! That was my last point. Try it out first to see what happens. Then feel free to comment. At first I thought it was because of my code, that there were no more content bytes, but my routine had been working perfectly for many years with exactly this web page. Only the subpage changed to "https://sonnenuntergang-zeit.de/sonnenuntergang:frankfurt-am-main:heute.html", but the whole website didn't work with our 'URLDownloadToFile'. Then I thought it was due to changing the site to https and Win7. Then I realized it was also affecting fresh Win10. Meaning now: I don't know if the web page is returning a wrong return value or not. Or if 'URLDownloadToFile' is actually buggy. Therefore again: Please just try it out first! Our 'URLDownloadToFile' returns an error -2146697211 as a long return value and no content and therefore no file is created. That's what it's all about now! I have written this in German to make it clear: It's only about this error on this website. I now get my sunset/sundown-times from one of these thousands of other sites that exist for this, so it's no longer my problem! ----------In Deutsch ----------
Nur um diese Seite: sonnenuntergang-zeit.deUm keine andere als diese Seite: sonnenuntergang-zeit.deRuft sie über eure 'URLDownloadToFile'-Routine auf und ihr bekommt einen Fehler als Return zurück und in der gespeicherten Datei kein einziges Byte Inhalt! Nur darum ging es mir zuletzt. Probiert es erst aus, damit ihr seht, was überhaupt passiert. Dann kommentiert gerne weiter. Anfangs dachte ich, es läge an meinem Code, dass da keine Inhaltsbytes mehr kamen, aber meine Routine funktionierte schon viele Jahre mit genau dieser Web-Seite perfekt. Lediglich die Unterseite änderte sich auf "https://sonnenuntergang-zeit.de/sonnenuntergang:frankfurt-am-main:heute.html", aber die ganze komplette Webseite funktioniert nicht mit unserer 'URLDownloadToFile'. Dann dachte ich, es läge an der Veränderung der Seite auf https und Win7. Dann merkte ich, dass es auch frisches Win10 betraf.
Bedeutet jetzt: ich weiß nicht, ob die Webseite einen falschen Return-Wert zurückliefert oder nicht. Oder ob 'URLDownloadToFile' eigentlich buggy ist. Daher nochmal: Probiert es bitte einfach erst aus! Unsere 'URLDownloadToFile' liefert einen Fehler -2146697211 als long-Return-Wert und eben keinerlei Inhalt zurück und es wird somit auch keine Datei erzeugt. Darum geht es jetzt und nur darum! Ich habe das jetzt extra auch mal in Deutsch geschrieben, um deutlich zu machen: Es geht nur um diesen Fehler bei dieser Webseite und unserer Funktion 'URLDownloadToFile'. Meine Tageszeiten hole ich mittlerweile über eine der zig-tausend anderen Seiten, die es dafür gibt, daher ist das nicht mehr mein Problem! Win10: sonnenuntergang-zeit.de/sonnenuntergang/frankfurt-am-main/ sonnenuntergang-zeit.de/sonnenuntergang/frankfurt-am-main:heute.html Bei beiden kommt der Fehler -2146697208 bei mir. Error from JobError Callback : hr= 0x80072ee7 Context=5 Description=The server name or address could not be resolved . Percentage downloaded = 0 Haben die Seite die URL umgestellt? das mit dem ":" Es ist möglich, dass die von Ihnen bereitgestellte URL "https://sonnenuntergang-zeit.de/sonnenuntergang/frankfurt-am-main:heute.html" speziell von der betreffenden Website verwendet wird und in ihrem Fall eine spezielle Bedeutung hat. In allgemeinen URL-Regeln und -Konventionen sollte jedoch ein ":" am Ende vermieden werden. Also eine spezielle Bedeutung um genau diese vorgehen mit automatischen Abfragen nun verhindern soll. Nach dem Windows Neustart, taucht er wieder auf obwohl der code durchlaufen wurde. Warum allerdings der Fehler immer wieder auftaucht ist mir ein Rätsel. Mit win10 wurden einige interne alte Funktionen abgeschaltet. Win32 soll ja irgendwann verschwinden.
Auf der Hauptseite nicht: Der Fehler -2146697211 weisst auf einen .Net 4 Windows Defender error hin. 0x80010005. answers.microsoft.com/en-us/windows/forum/all/error-code-0x800c0005-with-net-framework-4/13304fa3-dda5-438f-b078-3ddf1891cef3Evtl. .Net Updaten falls möglich? Eine 32bit .Net DLL könnte helfen das Problem zu lösen, bei der man aus GB32 diese DLL Aufruft und die Webseiten bekommt. Aber dazu muss man Sjouke Hamstra wiederum fragen, weil die 32bit .Net dlls header haben die man Proc Address aufrufen muss.
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 27, 2023 20:43:10 GMT 1
Ja, war früher anders, sehr alt.
Den Doppelpunkt hinter "heute:" in der URL sah ich auch, aber das ist egal, denn die ganze Webseite hatte einen relaunch und man kann ja keine der jetzigen Unterseiten mehr ohne den Fehler aufrufen, denn dieser kommt ja immer mit unserer Routine 'URLDownloadToFile'
|
|
|
Post by Roger Cabo on Nov 28, 2023 20:35:57 GMT 1
Ja, war früher anders, sehr alt. Den Doppelpunkt hinter "heute:" in der URL sah ich auch, aber das ist egal, denn die ganze Webseite hatte einen relaunch und man kann ja keine der jetzigen Unterseiten mehr ohne den Fehler aufrufen, denn dieser kommt ja immer mit unserer Routine 'URLDownloadToFile' Evtl muss man den ":" auf mit einem % erzeugen und in den utl string einfügen. & "%3A" &
|
|
webu
Full Member
Posts: 149
|
Post by webu on Nov 28, 2023 20:48:20 GMT 1
Wie gesagt, völlig egal. Alle Seiten von sonnenuntergang-zeit.de produzieren diesen Fehler, es kommt nicht ein einziges byte!
|
|
|
Post by (X) on Nov 29, 2023 23:09:51 GMT 1
Hello webu,
You certainly have found a "puzzler"...
URLDownloadtoFile() Microsoft.XMLHTTP Msxml2.ServerXMLHTTP winInet.dll
I was able to access other 'more permissive' websites with all the methods mentioned above.
I am only guessing, but, as far as I can tell, this site will only permit a Browser to access it and has perhaps found a way to block applications or 'robots' from gaining access without special conditions that are obviously unknown to me.
BING had many suggestions for checking the Windows configuration but admitted that if a Browser can access the site and a program or application can not, then it is likely not because of a bad configuration of Internet Options (TSL, SSL) or Windows OS.
I even tried telling the site which "User-Agent" was trying to access it:
objRequest.setRequestHeader "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3" There was always an error when trying to connect to: sonnenuntergang-zeit.de
Well, color me 'done for now'. Who knows, maybe something will turn up later. (There was a mention of open source 3rd party tools and utilities written in C, C++) Let's not forget roger's suggestion in his previous post in this thread: gb32.proboards.com/post/4133
|
|
|
Post by Roger Cabo on Nov 30, 2023 22:07:46 GMT 1
|
|
|
Post by (X) on Nov 30, 2023 22:23:03 GMT 1
Hi Roger,
Yes. This works for me too.
I think the way it works is: The downloaded file will essentially download the HTML of that URL or the actual file that is requested if it is made available by the website.
For the record, I was looking to download a JSON or XML data file and I started coding a JSON parser until I was intrigued about the fact that some websites apparently won't "talk" to applications that simply request a file download.
|
|