Ngonversi perintah CURL dadi kode Golang kanthi online

Curl command

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

CURL kanggo Go Online

Alat iki mbantu sampeyan ngasilake kode Go adhedhasar CURL Command. Salin lan Tempel CURL Command lan Generate Go.

Apa sampeyan bisa nindakake karo CURL to Go Converter Online?

  • CURL to Go minangka alat sing unik banget kanggo ngowahi perintah cURL dadi panyuwunan http saka Go. Input diwenehake dening perintah cURL pangguna kanggo ngasilake Kode Go.
  • Alat iki ngirit wektu lan mbantu nggawe kode Go kanthi gampang.
  • CURL to Go bisa digunakake ing Windows, MAC, Linux, Chrome, Firefox, Edge lan Safari.

apa iku CURL?

cURL minangka alat baris perintah open-source sing ndownload file saka web. Ndhukung macem-macem protokol, kalebu HTTP, HTTPS, FTP, SFTP, TFTP, Gopher lan liya-liyane.

Kepiye cara ngowahi CURL dadi kode Go? 

Langkah 1: Tempel lan ngowahi panjalukan CURL dadi kode Go

Langkah 2: Salin kode Go

Convert CURL kanggo Go conto

KULIT
cURL example.com
Go Kode
package main

import (
	"fmt"
	"io"
	"log"
	"net/http"
)

func main() {
	client := &http.Client{}
	req, err := http.NewRequest("GET", "http://example.com", nil)
	if err != nil {
		log.Fatal(err)
	}
	resp, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	bodyText, err := io.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%s\n", bodyText)
}