Hi!!!
I have a project I´m doing in the office. There is an arduino (yes!!) colector machine that sends data using https-get (=parameters in url) to a cloud server. This request needs a 'fingerprint', based on server-cert to handshake the connection and allow connectivy to site. OK, it s working done...
This servers collect data (an url API entry-point) and persist them in a cloud database.
Other API returns a compiled data list, JSon formatted, when called (... over https, too).
I need to get these data and process in my FB program. I tried to use the examples (get-https, http-page etc) I saw here, and the FB-prog works perfectly over http (:80). But, when I try the https (:443), it doesn´t connect, don´t handshake, ... I think that I´ll need to pass other data (like the fingerprint or security-cert) to handshake and accept the connection - and the data can be requested and retrieved, like http.
Well: Are there a lib, function, include or example code to work with https protocol (TLS or SSL)?
I can´t work with 'wget', 'curl' executables, (to get the file, save to disk and after that, read it via "open ... as #1'), due the Sec.Info restrictions in office..
Could you help me?
HTTPS Requests in FreeBasic
Re: HTTPS Requests in FreeBasic
You probably need some libraries, which deal with SSL/TLS stuff.
(cyptographically secured connections)
See: OpenSSL.org
On the use of those lib's, you'll have to consult their Documentation,
since they're not part of FBC.
(cyptographically secured connections)
See: OpenSSL.org
On the use of those lib's, you'll have to consult their Documentation,
since they're not part of FBC.
Re: HTTPS Requests in FreeBasic
There's also a library-version of curl, libcurl, which provides an API that you can use directly in your application instead of running external applications. Dealing with SSL yourself can get quite complicated, so I strongly advice to use some library that handles this for you (like the one I mentioned).
Re: HTTPS Requests in FreeBasic
For https protocol (port 443) I use Gio. Find a header file at https://github.com/DTJF/gir_headers/tree/master/Gir
Regards
Regards
Re: HTTPS Requests in FreeBasic
Sorry to revive this thread but the subject fit exactly my problem.St_W wrote:There's also a library-version of curl, libcurl, which provides an API that you can use directly in your application instead of running external applications. Dealing with SSL yourself can get quite complicated, so I strongly advice to use some library that handles this for you (like the one I mentioned).
I am trying to convert an old project because the HTTPS request not being handle correctly by TSNE.
(HTTP was ok but the site his now forcing HTTPS access)
I need to keep everything built-in (no external dll).
And i need to keep using the old version of freebasic (0.24)
So i am trying to upgrade from TSNE to Curl
But i am unable to use succesfully Curl without the use of the external "libcurl.dll"
I have downloaded the latest version from https://curl.se/download.html
I have copied "libcurl.a" and "libcurl.dll.a" under lib/Win32
What am i doing wrong ?
Re: HTTPS Requests in FreeBasic
Link it statically: https://stackoverflow.com/questions/324 ... staticallyFXG861 wrote:Sorry to revive this thread but the subject fit exactly my problem.St_W wrote:There's also a library-version of curl, libcurl, which provides an API that you can use directly in your application instead of running external applications. Dealing with SSL yourself can get quite complicated, so I strongly advice to use some library that handles this for you (like the one I mentioned).
I am trying to convert an old project because the HTTPS request not being handle correctly by TSNE.
(HTTP was ok but the site his now forcing HTTPS access)
I need to keep everything built-in (no external dll).
And i need to keep using the old version of freebasic (0.24)
So i am trying to upgrade from TSNE to Curl
But i am unable to use succesfully Curl without the use of the external "libcurl.dll"
I have downloaded the latest version from https://curl.se/download.html
I have copied "libcurl.a" and "libcurl.dll.a" under lib/Win32
What am i doing wrong ?
Re: HTTPS Requests in FreeBasic
If your application is targeting Windows only (as you're talking about DLL files) you could also use some windows api instead of liburl, e.g. https://docs.microsoft.com/en-us/window ... net/portal
Re: HTTPS Requests in FreeBasic
Thank you both for your suggestion.
My programs are DOS application that are making http Calls using Tsne (from ThePuppetMaster).
When i was doing windows application i was using "Window9" GUI library (from Vanya )
I don't want to redesign the programs.
I simply want to adjust them to work with Https.
Any support & Suggestion is always welcome !!!
My programs are DOS application that are making http Calls using Tsne (from ThePuppetMaster).
When i was doing windows application i was using "Window9" GUI library (from Vanya )
I don't want to redesign the programs.
I simply want to adjust them to work with Https.
Any support & Suggestion is always welcome !!!
Re: HTTPS Requests in FreeBasic
Do your really mean DOS application? (typically compiled with FreeBasic for DOS and needing a DOS extender to run) or just a Windows Console application? (typically compiled with FreeBasic for Win32/Win64 and optionally "-s console" argument). If I remember correctly TSNE doesn't support DOS and thus I guess it's just a win32 console application. On Windows TSNE uses Windows' WinSock2 API as far as I know. I'd recommend replacing that by WinHTTP API (or the older WinInet API).
All three are included with any Windows version since 20 years (Windows 2000 and later), some even longer. Detailed documentation is available from Microsoft on MSDN:
WinSock2: https://docs.microsoft.com/en-us/window ... art-page-2
WinHTTP: https://docs.microsoft.com/en-us/window ... start-page
WinInet: https://docs.microsoft.com/en-us/window ... net/portal
All three are included with any Windows version since 20 years (Windows 2000 and later), some even longer. Detailed documentation is available from Microsoft on MSDN:
WinSock2: https://docs.microsoft.com/en-us/window ... art-page-2
WinHTTP: https://docs.microsoft.com/en-us/window ... start-page
WinInet: https://docs.microsoft.com/en-us/window ... net/portal
Re: HTTPS Requests in FreeBasic
Hi St_W,
You are right !!!
I ment Freebasic Windows 32 bits compiler, the application running inside a console window.
Sorry for the confusion.
You are right !!!
I ment Freebasic Windows 32 bits compiler, the application running inside a console window.
Sorry for the confusion.