Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

620
Visualizações
Error : problem in get data from php page with volley in kotlin android

i have an android app that must recieving data from a web service. this is my kotlin code:

class Main22Activity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main22)
    tv_button.setOnClickListener {

        getUsers()

    }
}
fun getUsers() {
    // Instantiate the RequestQueue.
    val queue = Volley.newRequestQueue(this)
    val url: String = "http://sam01.epizy.com/users/login.php/"

    // Request a string response from the provided URL.
    val stringReq = StringRequest(com.android.volley.Request.Method.GET, url,
        Response.Listener<String> { response ->

            var strResp = response.toString()
            tv_users!!.setText(strResp)
        },
        Response.ErrorListener { tv_users!!.setText("That didn't work!") })
    queue.add(stringReq)
}

and in login.php i have a simple code that return an array in json format:

<?php
 header('Content-Type: application/json');
$myArr = array("John", "Mary", "Peter", "Sally");

$myJSON = json_encode($myArr);

echo $myJSON;
?>

in browser it work without any problem.

["John","Mary","Peter","Sally"]

but when i run android app the result has a confusing error:

    <html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("ebe916d9dc3ebd0436538954c6fc9520");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://sam01.epizy.com/users/login.php/?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>

It should be noted that when I change url and use https://androidteachers.com/?json=get_category_index, for example, it's not a problem

please help me thanks

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda