If I want to execute a php script, i just point the browser to www.something.com/myscript.php
But if i want to execute a specific function inside
I am using this on my website. To use this simply format your url like this www.something.com/myscript.php?function=myFunction&arg=foo&otherarg=bar
It doesn't matter what you call the args in the url and you can have as many args as you want.
0){
//handle args
foreach($_GET as $arg){
array_push($args,$arg);
}
}
$result = call_user_func_array($function,$args);
//this part is only necessary if you want to send a response to a http request.
if(is_bool($result)){
die(($r)?'true':'false');
}
else if(is_array($result)){
die(json_encode($result));
}
else {
die($result);
}
}
myFunction($foo,$bar){
echo $foo." ".$bar;
}
?>