I’ll show two type of query string for this example.
I know that a query string for a web service, should be look like more 1 than 2
My question is: how do you manage the first one in php? isnt this just an url rewrite for the second one?
with the #2 query string, I suppose there’s a findbyproductcode.php page that process the GET variable(?productcode=4xxheua), check some databases with this productcode and send back some data.
How the #1 is supposed to work? should I have a 4xxheua.php? (obviously not…) … i just dont get this.
The only reason you’d prefer 1 over 2 is because 1 is more semantically intuitive.
It makes sense to have a URL like:
http://www.myblog.com/article/2012-04-29/i-did-nothing-all-day
Rather than
http://www.myblog.com/index.php?page=article&id=23423
Supposedly it also helps your SEO score.
If you’re just building a webservice, as in: machines talk to machines – then it doesn’t matter what the URL looks like. You could also just have one URL that accepts all inputs and do the ‘routing’ internally based on the input data.