CURL komutlarını çevrimiçi olarak Java HttpURLConnection koduna dönüştürün

Curl command

Examples: GET - POST - JSON - Basic Auth - Files - Form

CURL'den Java HttpURLConnection Online'a

Bu araç, CURL Komutuna dayalı Java HttpURLConnection kodu oluşturmanıza yardımcı olur. CURL Komutunu Kopyalayıp Yapıştırın ve Java HttpURLConnection Oluşturun.

CURL to Java HttpURLConnection Converter Online ile neler yapabilirsiniz?

  • CURL to Java HttpURLConnection, cURL denetimi Java HttpURLConnection'ın Java HttpURLConnection isteğine dönüştürme için çok yönlü bir araçtır. Java HttpURLConnection Kodu oluşturmak için kullanıcılar cURL süresi tarafından ulaştı.
  • Bu araç boyutunu zaman kazandırır ve Java HttpURLConnection kodunu oluşturmanıza yardımcı olur.
  • CURL to Java HttpURLConnection, Windows, MAC, Linux, Chrome, Firefox, Edge ve Safari'de iyi çalışır.

CURL nedir?

cURL, web'den dosya indiren açık kaynaklı bir komut bilgi aracıdır. Java HttpURLConnection, Java HttpURLConnectionS, FTP, SFTP, TFTP, Gopher ve diğerleri dahil olmak üzere çeşitli protokolleri verildi.

CURL'yi Java HttpURLConnection koduna nasıl dönüştürebilirim? 

1. Adım: CURL kısıtlamalarınızı çalıştırma ve Java HttpURLConnection kodununa dönüştürün

2. Adım: Java HttpURLConnection kodunu kopyalayın

CURL'yi Java HttpURLConnection örneğine dönüştürmekün

KIRMIZI
curl example.com
Java HttpURLBağlantı Kodu
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);
    }
}