java - HTTP Request in Kotlin -


i'm new kotlin. want login validation using post method , information using method. i've url, server username , password of previous project. didn't find proper example project uses thing. please suggest me working example can use , post method in http request

you can use standard libraries use in java. example httpurlconnection:

private fun sendget() {     val url = "http://www.google.com/"     val obj = url(url)      with(obj.openconnection() httpurlconnection) {         // optional default         requestmethod = "get"           println("\nsending 'get' request url : $url")         println("response code : $responsecode")          bufferedreader(inputstreamreader(inputstream)).use {             val response = stringbuffer()              var inputline = it.readline()             while (inputline != null) {                 inputline = it.readline()                 response.append(inputline)             }             println(response.tostring())         }     } } 

that's how sent simple http requests server. i'd suggest apache httpcomponents or whatever framework you'd use when comes complex tasks. android volley place started.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -