Hallo!
Ich möchte anhand einer nmea Datei (https://www.dropbox.com/s/0p8y02pse4nf2o7/2019-06-13_121144.674.as.nmea?dl=0) über gpsvisualizer.com eine Map erstellen, wo ich dann den Downloadlink für die Karte ermitteln möchte.
Dazu habe ich bis jetzt immer folgenden Code verwendet, der auch immer funktioniert hat.
Laut gpsvisualizer wurde die Seite jetzt auf https geändert. Ich habe meiner Meinung nach alle Änderungen angepasst.
Hier mein Code
Public Function gpslink(datei As String) As String
Dim strFile As String
Dim strHttp As String
Dim DestUrl As URL
'Dim datei As String
'datei = "D:\eigene dateien\vb\datenlogger - totorovic\nmea.txt"
strdatei = Mid(datei, InStrRev(datei, "\", -1) + 1)
strUrl = "https://www.gpsvisualizer.com/map?output_home"
strName = "uploaded_file_1"
strMIMEType = "multipart/form-data"
' if a request is allredy being sent
' exit
If blnConnected Then Exit Function
' check that a file was selected
If datei = vbNullString Then
MsgBox "No File Chosen", vbCritical, "ERROR"
Exit Function
End If
' extract the URL using a helper function
DestUrl = ExtractUrl(strUrl)
If DestUrl.Host = vbNullString Then
MsgBox "Invalid Host", vbCritical, "ERROR"
Exit Function
End If
' clear the old response
strResponse = ""
' read the file contents as a string
' N.B: in HTTP everything is a string, even binary files
strFile = GetFileContents(datei)
' build the HTTP request
strHttp = BuildFileUploadRequest(strFile, DestUrl, strName, strdatei, _
strMIMEType)
' assign the protocol host and port
Winsock1.Protocol = sckTCPProtocol
Winsock1.RemoteHost = DestUrl.Host
If DestUrl.Port <> 0 Then
Winsock1.RemotePort = DestUrl.Port
Else
Winsock1.RemotePort = 80
End If
' make the connection and send the HTTP request
Winsock1.Connect
While Not blnConnected
DoEvents
Wend
strRequest = strHttp
Winsock1.SendData strHttp
While blnConnected
DoEvents
Wend
'Clipboard.SetText strResponse
'Debug.Print Len(strResponse)
Dim intview As Integer
Dim pfad As String
intview = InStr(1, strResponse, "view")
If intview > 0 Then
pfad = Mid(strResponse, 1, intview - 3)
gpslink = Mid(pfad, InStrRev(pfad, "/", -1))
gpslink = "https://www.gpsvisualizer.com/display" & gpslink & " "
Else
gpslink = ""
End If
If blnConnected Then blnConnected = False
End Function |