1. Are you ready for the Galaxy S20? Here is everything we know so far!

Can't get info back into android app from php webpage

Discussion in 'Android Development' started by christiaan89, May 2, 2021.

  1. christiaan89

    christiaan89 Lurker
    Thread Starter

    Hello

    My english is very bad, so i hope you understand.

    I make my own apps, and most off the time in fragment activities
    On my website i have a php script, that will check if the username and password is correct filled in in the application.

    I hace to get back from the website the userID, firstname and email address from the database, this info is stored in a json format like below:
    Code (Text):
    1.  
    2. $result1["rol"] = $rol;
    3.         $result1["login"] = $login;
    4.         $result1["username"] = $Qusername;
    5.         $result1["userid"] = $userID;
    6.         $result1["mail"] = $Qmail;
    7.         echo json_encode($result1);
    8.  
    login is a 0 or 1 for check if the user is correct login.

    ut how to get the $result1 back to android.....
     



    1. Download the Forums for Android™ app!


      Download

       
  2. christiaan89

    christiaan89 Lurker
    Thread Starter

    I have the following on my website visible

    Code (Text):
    1.  
    2.  
    3. {"rol":"9","login":"1","username":"christiaan","userid":"9998","mail":"c.***@h***e.nl"}
    4.  
    5.  

    And I tried to read that in android with:


    Code (Text):
    1.  
    2.  
    3. val apiResponse = URL(urlW).readText()
    4.  
    5.  
    6. val url = URL(urlW)
    7.  
    8. val urlConnection = url.openConnection() as HttpURLConnection
    9.  
    10. val text = urlConnection.inputStream.bufferedReader().readText()
    11.  
    12. tUser.text = text
    13.  
    14. urlConnection.disconnect()
    15.  
    16.  
    17.  
    urlW contains the full link.


    I write app in kotlin.
     
Loading...
Similar Threads - Can't info android
  1. Syahhhh3333
    Replies:
    5
    Views:
    282
  2. dorlow
    Replies:
    22
    Views:
    618
  3. James_Watson
    Replies:
    10
    Views:
    454
  4. oscarvn
    Replies:
    2
    Views:
    281
  5. behrprofl
    Replies:
    6
    Views:
    786
  6. Clemworld
    Replies:
    3
    Views:
    555
  7. Randy Freemire
    Replies:
    2
    Views:
    411
  8. dontpanicbobby
    Replies:
    6
    Views:
    408
  9. Wax Bean Tycoon
    Replies:
    3
    Views:
    340
  10. mtiede
    Replies:
    8
    Views:
    860

Share This Page

Loading...