cs1942: redirected - Lesen Inhalt umgeleiterten Seite in VB

Beitrag lesen

Hello,

Kann mir jemand mitteilen, wie ich den richtigen Inhalt bekommen kann?
indem du alle Informationen auswertest...sorry, aber mehr kann ich in Anbetracht der Informationslage nicht sagen. Wie führst du den Redirect durch, schickst du einen entsprechenden Header? Wie rufst du die Seite ab? Jenachdem könnte hier bereits Unterstützung für das Redirect drin sein oder eben nicht, im Zweifel musst du den gesendeten selbst auswerten und darauf reagieren.

MfG
Rouven

Hallo Rouven,

leider weiss ich nicht wie der Redirect durch den URL-Eigner durchgeführt wird.

Hier ist der vollständiger Code, mit welchem ich die Seite lese:
------------------------------------------------------------------------

Private Type STARTUPINFO
      cb As Long
      lpReserved As String
      lpDesktop As String
      lpTitle As String
      dwX As Long
      dwY As Long
      dwXSize As Long
      dwYSize As Long
      dwXCountChars As Long
      dwYCountChars As Long
      dwFillAttribute As Long
      dwFlags As Long
      wShowWindow As Integer
      cbReserved2 As Integer
      lpReserved2 As Long
      hStdInput As Long
      hStdOutput As Long
      hStdError As Long
   End Type

Private Type PROCESS_INFORMATION
      hProcess As Long
      hThread As Long
      dwProcessID As Long
      dwThreadID As Long
   End Type

Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
      hHandle As Long, ByVal dwMilliseconds As Long) As Long

Private Declare Function CreateProcessA Lib "kernel32" _
      (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, _
       ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
       ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
       ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
       lpStartupInfo As STARTUPINFO, _
       lpProcessInformation As PROCESS_INFORMATION) As Long

Private Declare Function CloseHandle Lib "kernel32" _
      (ByVal hObject As Long) As Long

Private Declare Function GetExitCodeProcess Lib "kernel32" _
      (ByVal hProcess As Long, lpExitCode As Long) As Long

Private Const NORMAL_PRIORITY_CLASS = &H20&
   Private Const DETACHED_PROCESS = &H8&       'unterbindet Asugabe auf dem Monitor
   Private Const INFINITE = -1&

Public Function ExecCmd(cmdline$)
      Dim proc As PROCESS_INFORMATION
      Dim start As STARTUPINFO

' Initialize the STARTUPINFO structure:
      start.cb = Len(start)

' Start the shelled application:
      ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
         NORMAL_PRIORITY_CLASS + DETACHED_PROCESS, 0&, vbNullString, start, proc)

' Wait for the shelled application to finish:
         ret& = WaitForSingleObject(proc.hProcess, INFINITE)
         a = a

Call GetExitCodeProcess(proc.hProcess, ret&)
         Call CloseHandle(proc.hThread)
         Call CloseHandle(proc.hProcess)
         ExecCmd = ret&
   End Function

Function URL_seiten_inhalt(link As String) As String

Dim hInst As Integer
Dim thecmd As String

On Error GoTo s1_error

URL_seiten_inhalt = ""
' curl Programm aufrufen und HTML Datei aus dem Internet laden und auf Platte schreiben
thecmd = "curl -o d:\x.txt " & link
ExecCmd (thecmd)
' Jetzt die geladene HTML Datei öffnen und einlesen
fnum = FreeFile()
Open "d:\x.txt" For Input Access Read As fnum
flen = LOF(fnum)
URL_seiten_inhalt = Input(flen, fnum)  ' Daten einlesen
Close fnum

s1_content:
    Exit Function

s1_error:
    URL_seiten_inhalt = "Fehler!"
    GoTo s1_content

End Function
----------------------------------------------------------------------

Wenn ich die Origanal-URL-Adresse
http://e-izvadak.pravosudje.hr/mpweb/jsp/menu/menusud.jsp?sudid=1
manuell eingebe bekomme ich auf dem Bildschirm die richtige Seite angezeigt.

Wenn ich die Seite mit dem oben aufgeführten VB-Programm aufrufe bekomme ich in der Datei d:\x.txt folgenden Inhalt:
<HTML><HEAD><TITLE>Redirect to http://e-izvadak.pravosudje.hr/mpweb/jsp/zk/menugk.jsp</TITLE></HEAD><BODY><A HREF="http://e-izvadak.pravosudje.hr/mpweb/jsp/zk/menugk.jsp">http://e-izvadak.pravosudje.hr/mpweb/jsp/zk/menugk.jsp</A></BODY></HTML>

Und das ist nicht das, was ich benötige. Ich erwarte den Quelcode der Seite die auf dem Bildschirm angezeigt bekomme.

MfG
cs1942