Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (Byval sAgent As String, Byval _
lAccessType As Long, Byval sProxyName As String, Byval sProxyBypass As String, Byval lFlags As Long) As Long
Declare Function InternetCloseHandle Lib "wininet" (Byval hInet As Long) As Integer
Declare Function InternetReadFile Lib "wininet" (Byval hFile As Long, Byval sBuffer As String, Byval _
lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (Byval hInternetSession As Long, _
Byval lpszUrl As String, Byval lpszHeaders As String, Byval dwHeadersLength As Long, Byval dwFlags As Long, _
Byval dwContext As Long) As Long
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const UserAgent = "Wininet Test"
Sub Click(Source As Button)
Dim ws As New NotesUIWorkSpace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Dim l&, Buffer$, hOpen&, hFile&, Result&
l = 50000
Buffer = Space(l)
url = "http://www.atnotes.de"
' hOpen = InternetOpen(UserAgent, INTERNET_OPEN_TYPE_DIRECT, 0&, 0&, 0) ' ohne Proxy
' hOpen = InternetOpen(UserAgent, INTERNET_OPEN_TYPE_PROXY, 0&, 0&, 0) ' mit Proxy
hOpen = InternetOpen(UserAgent, 0, 0&, 0&, 0) ' wie in Windows eingestellt
hFile = InternetOpenUrl(hOpen,url, 0&, 0&, INTERNET_FLAG_RELOAD, 0&)
Call InternetReadFile(hFile, Buffer, l, Result&)
Call InternetCloseHandle(hFile)
Call InternetCloseHandle(hOpen)
Buffer = Left$(Buffer, Result)
Call uidoc.FieldSetText("Body", Buffer) ' QuellCode ins Feld schreiben
Open "d:\ATNotes\_dokument.htm" For Output As #1
Print #1, Buffer ' Quellcode in Datei schreiben
Close #1
End Sub
Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (Byval sAgent As String, Byval _
lAccessType As Long, Byval sProxyName As String, Byval sProxyBypass As String, Byval lFlags As Long) As Long
Declare Function InternetCloseHandle Lib "wininet" (Byval hInet As Long) As Integer
Declare Function InternetReadFile Lib "wininet" (Byval hFile As Long, Byval sBuffer As String, Byval _
lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (Byval hInternetSession As Long, _
Byval lpszUrl As String, Byval lpszHeaders As String, Byval dwHeadersLength As Long, Byval dwFlags As Long, _
Byval dwContext As Long) As Long
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const UserAgent = "Wininet Test"
Sub Click(Source As Button)
Dim l&, Buffer$, hOpen&, hFile&, Result&
l = 50000
Buffer = Space(l)
url = "http://www.atnotes.de"
' hOpen = InternetOpen(UserAgent, INTERNET_OPEN_TYPE_DIRECT, 0&, 0&, 0) ' ohne Proxy
' hOpen = InternetOpen(UserAgent, INTERNET_OPEN_TYPE_PROXY, 0&, 0&, 0) ' mit Proxy
hOpen = InternetOpen(UserAgent, 0, 0&, 0&, 0) ' wie in Windows eingestellt
hFile = InternetOpenUrl(hOpen,url, 0&, 0&, INTERNET_FLAG_RELOAD, 0&)
Call InternetReadFile(hFile, Buffer, l, Result&)
Call InternetCloseHandle(hFile)
Call InternetCloseHandle(hOpen)
Buffer = Left$(Buffer, Result)
Open "d:\ATNotes\_dokument.htm" For Output As #1
Print #1, Buffer ' Quellcode in Datei schreiben
Close #1
End Subpublic String getHTML(String urlToRead) {
URL url; // The URL to read
HttpURLConnection conn; // The actual connection to the web page
try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
}
}try {
url = new URL(urlToRead);
conn = (HttpURLConnection) url.openConnection();
conn.connect();
if (conn.getResponseCode() == 200 ) System.out.println("alles ok"); System.out.println("nix gut. Response code=" + conn.getResponseCode());
conn.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
}
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
result += line;
}
rd.close();
} catch (Exception e) {
e.printStackTrace();
}
Was heisst nur die URL abzuschicken.Es soll so sein wie wenn ich den Browser öffne, eine Url eingebe, auf Enter drücke und dann den Browser wieder schließe.
Und es heisst Methode, nicht Funktion.Sorry wusste ich nicht. Java ist absolutes Neuland für mich.
Du willst den Request ausführen, aber nix zurückerhalten?Genau.
Ich mein das nicht böse oder ärgerlich. Ich hab nur beschlossen bei solchen grundsätzlichen Sachen spiessig zu sein. Gibt ziemlich viele Leute, die auf solche fundamental falsche Sprache aggressiv reagieren. Und ich kanns verstehen.Und es heisst Methode, nicht Funktion.Sorry wusste ich nicht. Java ist absolutes Neuland für mich.
...Frag weiter, wenns nicht klappt.Mach ich. Danke. :)