0

With reference to this link open a url on click of ok button in android

i want to call php function in my xampp server by the builder button click "ok"

Community
  • 1
  • 1
aanagan
  • 1
  • 2

1 Answers1

1
Uri uri = Uri.parse("10.0.2.2/sth.php?runFunction=true");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

PHP:

<?php 
if($_GET["runFunction"] == true){
    myFunction();
}

function myFunction(){
    ...
}
?>
Al Kafri Firas
  • 323
  • 3
  • 15
  • Uri uri = Uri.parse("10.0.2.2/sth.php?runFunction=true"); how to set username and password . my php function is located within a localhost server with some username and password – aanagan Dec 09 '14 at 08:02
  • Then you `$_GET` the username and password variables and compare them against your database or whatever then you call the function. – Al Kafri Firas Dec 09 '14 at 09:00
  • can you give me an example code or something. i am an amateur – aanagan Dec 09 '14 at 09:41
  • This is a good [Tutorial](http://www.phpeasystep.com/phptu/6.html). Also don't forget to vote ;) – Al Kafri Firas Dec 09 '14 at 09:53