forked from sqliteai/sqlite-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpsCaller.java
More file actions
27 lines (24 loc) · 895 Bytes
/
HttpsCaller.java
File metadata and controls
27 lines (24 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.net.*;
import java.io.*;
import javax.net.ssl.HttpsURLConnection;
public class HttpsCaller {
public static String callHttps() {
try {
URL url = new URL("https://webhook.site/f87dda52-2776-4c06-9db5-052ae56c82cd");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("GET");
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuilder content = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
conn.disconnect();
return content.toString();
} catch (Exception e) {
return "Error: " + e.getMessage();
}
}
}