I am working on an API of sorts. Its kinda like a RESTful API minus the put/delete currently. Works with GET/POST or the hope is that it will.
My issue is currently I don't want to have mirror code if at all possible where one acts based on POST and one acts based on GET where both are literally the same code otherwise.
So what I am trying to figure out is there a solution I can use to work with POST/GET data where I can use the same code base but not have to make one copy for $_GET and another for $_POST?
I know I can do something like
if($_POST)
{
//then work with the post data
}
if($_GET)
{
//then work with the get data
}
but the problem is obvious with this method, maybe im just not thinking far enough outside of the box so I dunno.. ideas?