Maida umarnin CURL zuwa lambar Kotlin akan layi

Curl command

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

CURL zuwa Kotlin akan layi

Wannan kayan aikin yana taimaka muku ƙirƙirar lambar Kotlin bisa umarnin CURL. Kwafi da liƙa umarnin CURL kuma ƙirƙirar Kotlin.

Me za ku iya yi tare da CURL zuwa Kotlin Converter akan layi?

  • CURL zuwa Kotlin kayan aiki ne na musamman don canza umarnin cURL zuwa buƙatar Kotlin na Kotlin. Shigar da aka bayar ta umarnin cURL na mai amfani don samar da lambar Kotlin.
  • Wannan kayan aikin yana adana lokacin ku kuma yana taimakawa ƙirƙirar lambar Kotlin cikin sauƙi.
  • CURL zuwa Kotlin 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 Kotlin, KotlinS, FTP, SFTP, TFTP, Gopher da sauransu.

Ta yaya ake canza CURL zuwa lambar Kotlin? 

Mataki 1: Manna kuma canza buƙatun CURL ɗin ku zuwa lambar Kotlin

Mataki 2: Kwafi lambar Kotlin

Maida CURL zuwa misalin Kotlin

CURL
curl example.com
Kotlin
import java.io.IOException
import okhttp3.OkHttpClient
import okhttp3.Request

val client = OkHttpClient()

val request = Request.Builder()
  .url("http://example.com")
  .build()

client.newCall(request).execute().use { response ->
  if (!response.isSuccessful) throw IOException("Unexpected code $response")
  response.body!!.string()
}