Android: Handle PHP response from HTTP post -


i trying understand how deal response i'm getting php login page http post. rather make question 3 pages long posted links both files need see. both each 100 lines of code.

--->java<--- code handles http post , response

--->php<--- code validates username/password

now problem. when enter invalid username/password response

05-21 17:59:38.012: v/response(24420):         <script>window.location.href="index.php?err_msg=1";</script>         <!--<script>window.location.href="index.php?err_msg=1";</script>-->         <!-- <meta http-equiv="refresh" content="0;url=index.php?err_msg=1">-->     

when values valid response

05-21 17:56:54.892: v/response(24420):                   <script>window.location.href="welcome.php";</script>               <!--  <meta http-equiv="refresh" content="0;url=welcome.php">   -->     !--<script>window.location.href="index.php?err_msg=1";</script>-->       <!-- <meta http-equiv="refresh" content="0;url=index.php?err_msg=1">-->     

if @ php file it's easy enough see coming from. don't know how deal it. sites i've done respond "true", "1", "success" or else generic successful or unsuccessful login. how handle response? copy paste entire response in if else statement seems wrong thing do.

so, question: has seen before , do type of response? alternatively, should create web service handle login rather use default php website developer created?

it looks php code not intended used mobile clients , expecting "clients" web browsers. hence use of cookies & sessions. if written perspective of providing api use authentication via http headers , kind of token exchange.

i think php complicated work with. way can php adjusted more api workflow?


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -