CURL zuwa Java HttpURLCHaɗin Kan layi
Wannan kayan aikin yana taimaka muku ƙirƙirar lambar haɗin haɗin Java HttpURLC bisa umurnin CURL. Kwafi da Manna Umarnin CURL kuma Ƙirƙirar haɗin haɗin Java HttpURLC.
Me zaku iya yi da CURL zuwa Java HttpURLCConnection Converter Online?
- CURL zuwa Java HttpURLCHaɗin kai kayan aiki ne na musamman don canza umarnin cURL zuwa buƙatar haɗin haɗin Java HttpURLC na Java HttpURLConnection. Shigar da shigarwar ta hanyar umarnin cURL na mai amfani don samar da lambar haɗin haɗin Java HttpURLC.
- Wannan kayan aikin yana adana lokacinku kuma yana taimakawa ƙirƙirar lambar haɗin haɗin Java HttpURLC cikin sauƙi.
- CURL zuwa Java HttpURLCHaɗin yana aiki da kyau akan Windows, MAC, Linux, Chrome, Firefox, Edge da Safari.
menene CURL?
cURL kayan aikin layin umarni ne mai buɗewa wanda ke zazzage fayiloli daga gidan yanar gizo. Yana goyan bayan ka'idoji iri-iri, gami da Java HttpURLConnection, Java HttpURLConnectionS, FTP, SFTP, TFTP, Gopher da sauransu.
Ta yaya ake canza CURL zuwa lambar haɗin haɗin Java HttpURLC?
Mataki 1: Manna kuma canza buƙatun CURL ɗin ku zuwa lambar haɗin haɗin Java HttpURLC
Mataki 2: Kwafi lambar haɗin haɗin Java HttpURLC
Maida CURL zuwa misalin haɗin haɗin Java HttpURLC
CURL
curl example.com
Java HttpURLC Code Connection
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);
}
}