CURL zuwa Kan layi
Wannan kayan aikin yana taimaka muku ƙirƙirar lambar Go bisa ga Umurnin CURL. Kwafi da Manna Umarnin CURL kuma Samar da Go.
Me zaku iya yi da CURL zuwa Go Converter Online?
- CURL zuwa Go kayan aiki ne na musamman don canza umarnin cURL zuwa buƙatar http na Go. Shigar da aka bayar ta umarnin cURL na mai amfani don samar da Go Code.
- Wannan kayan aikin yana adana lokacinku kuma yana taimakawa ƙirƙirar lambar Go cikin sauƙi.
- CURL to Go 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 HTTP, HTTPS, FTP, SFTP, TFTP, Gopher da sauransu.
Ta yaya ake canza CURL zuwa lambar Go?
Mataki 1: Manna kuma canza buƙatun CURL ɗin ku zuwa lambar Go
Mataki 2: Kwafi Go code
Maida CURL zuwa Misalin Go
CURL
cURL example.com
Go Code
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)
}