I want to do a login validation using POST method without any third party library and to get some information using GET method.
I've URL, server Username and Password already of my previous project.
Solution -->
For Android, Volley is a good place to get started. For all platforms, you might also want to check out ktor client or http4k which are both good libraries.
However, you can also use standard Java libraries like java.net.HttpURLConnection which is part of the Java SDK:
fun sendGet() {
val url = URL("http://www.google.com/")
with(url.openConnection() as HttpURLConnection) {
requestMethod = "GET" // optional default is GET
println("\nSent 'GET' request to URL : $url; Response Code : $responseCode")
inputStream.bufferedReader().use {
it.lines().forEach { line ->
println(line)
}
}
}
}
Or simpler:
URL("https://google.com").readText()
https://www.codeblogs.info/programming-stuff-on-codeblogs
https://www.codeblogs.info/hashmap-introduction
https://www.codeblogs.info/java-issues-fixed-in-kotlin
https://www.codeblogs.info/android-studio-stuck-at-installing-apk
https://www.codeblogs.info/make-link-clickable-in-container-that
0 Comments