import java.net.HttpURLConnection import java.net.URL import java.util.Scanner fun main() { val url = URL("https://shabanic.ir/api/v1/postal_code?postal_code=9461784468") val connection = url.openConnection() as HttpURLConnection connection.requestMethod = "POST" connection.setRequestProperty( "SHABANIC-API-KEY", "KT2u2yU7dg7LAPXt3gsVMYVFtRV3TBV7G3bGjzPm2ztYJj1AM64H78DODLTG5zyLlgFyNYzXLUVZPvvJlUMVtU7" ) connection.doOutput = true val scanner = Scanner(connection.inputStream) while (scanner.hasNextLine()) { println(scanner.nextLine()) } scanner.close() }