Hello,
.
I recently installed Kubuntu 24.04.3 LTS in dual boot with Windows 11. My intention is to explore this environment, which I’m not very familiar with. Especially since two of the applications I use regularly are installed by default: Firefox and LibreOffice. However, Base wasn’t installed, but I was able to do so without too much trouble.
.
I have an embedded HSQLDB database that I can use on both Windows and Linux. However, I’ve currently noticed that one of my database functions doesn’t work on Linux, and the reason seems to be that some features are Windows-related and can’t be executed on Linux.
.
Could someone help me find an equivalent so that it works on Linux, or at least give me some suggestions for solutions?
.
Here’s my StarBasic function:
.
' -----------------------------------------------------------------------------------------------------------------------
' Nom : GetSourceText
' Rôle : Télécharge le code source HTML depuis l'URL indiquée.
' Paramètres :
' sURL : URL à télécharger (String)
' Retour : Code HTML sous forme de chaîne si succès, sinon chaîne vide.
' Remarques :
' - Gestion d'erreurs essentielle uniquement
' -----------------------------------------------------------------------------------------------------------------------
Private Function GetSourceText(sURL As String) As String
Dim oHTTP As Object
Dim sHTML As String, sMsg As String
Const TIMEOUT_CONNECT = 5000
Const TIMEOUT_SEND = 10000
Const TIMEOUT_RECEIVE = 30000
Const TIMEOUT_RESOLVE = 30000
On Error GoTo ErrorHandler
' Validation de l'URL
If Trim(sURL) = "" Or Not (LCase(sURL) Like "http*://*") Then
ShowMsgBox "URL invalide ou manquante.", BtnOK, IconStop, "Erreur"
Exit Function
End If
' Création de l'objet HTTP
Set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")
If IsNull(oHTTP) Then
ShowMsgBox "Impossible de créer l'objet HTTP.", BtnOK, IconStop, "Erreur"
Exit Function
End If
' Configuration des délais
oHTTP.setTimeouts TIMEOUT_RESOLVE, TIMEOUT_CONNECT, TIMEOUT_SEND, TIMEOUT_RECEIVE
' Envoi de la requête
oHTTP.Open "GET", sURL, False
oHTTP.setRequestHeader "User-Agent", _
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
oHTTP.Send
' Traitement de la réponse
Select Case oHTTP.Status
Case 200
sHTML = Trim(oHTTP.ResponseText)
If sHTML = "" Then
ShowMsgBox "Contenu vide reçu.", BtnOK, IconWarning, "Avertissement"
Else
GetSourceText = sHTML
End If
Case 403
ShowMsgBox "Erreur HTTP 403 - Accès interdit.", BtnOK, IconStop, "Erreur"
Case 404
ShowMsgBox "Erreur HTTP 404 - Page non trouvée.", BtnOK, IconStop, "Erreur"
Case Else
ShowMsgBox "Erreur HTTP " & oHTTP.Status, BtnOK, IconStop, "Erreur"
End Select
CleanExit:
On Error Resume Next
Set oHTTP = Nothing
On Error GoTo 0
Exit Function
ErrorHandler:
ShowMsgBox "Erreur de connexion : " & Err.Description, BtnOK, IconStop, "Erreur"
GetSourceText = ""
Resume CleanExit
End Function
Thank you for your attention to this request.