CURL għal Java HttpURLConnection Online
Din l-għodda tgħinek tiġġenera kodiċi Java HttpURLConnection ibbażat fuq CURL Command. Ikkopja u Paste Kmand CURL u Iġġenera Java HttpURLConnection.
X'tista' tagħmel b'CURL għal Java HttpURLConnection Converter Online?
- CURL għal Java HttpURLConnection hija għodda unika ħafna biex tikkonverti kmand cURL għal Java HttpURLConnection talba ta 'Java HttpURLConnection. L-input ipprovdut mill-kmand tal-cURL tal-utent biex jiġġenera Kodiċi ta 'Java HttpURLConnection.
- Din l-għodda tiffranka l-ħin tiegħek u tgħin biex tiġġenera kodiċi Java HttpURLConnection bil-faċilità.
- CURL għal Java HttpURLConnection jaħdem tajjeb fuq Windows, MAC, Linux, Chrome, Firefox, Edge u Safari.
x'inhu CURL?
cURL hija għodda tal-linja tal-kmand open-source li tniżżel fajls mill-web. Jappoġġja varjetà ta 'protokolli, inklużi Java HttpURLConnection, Java HttpURLConnectionS, FTP, SFTP, TFTP, Gopher u oħrajn.
Kif tikkonverti CURL għal kodiċi Java HttpURLConnection?
Pass 1: Paste u kkonverti t-talbiet tiegħek CURL għall-kodiċi Java HttpURLConnection
Pass 2: Ikkopja l-kodiċi Java HttpURLConnection
Ikkonverti CURL għal eżempju Java HttpURLConnection
CURL
curl example.com
Java HttpURLKonnessjoni Kodiċi
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("http://example.com");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("GET");
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}