HTTP Client
ใช้ net/http package สำหรับทำ HTTP requests
Basic GET Request
Section titled “Basic GET Request”package main
import ( "fmt" "io" "net/http")
func main() { resp, err := http.Get("https://api.example.com/users") if err != nil { panic(err) } defer resp.Body.Close()
body, err := io.ReadAll(resp.Body) if err != nil { panic(err) }
fmt.Println("Status:", resp.StatusCode) fmt.Println("Body:", string(body))}เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google