Ok, this is probably something answered millions of times, but I couldn't find an answer on Google (maybe I'm using the wrong parameters?).
Here is the thing:
I'm planning to implement a REST webservice using PHP. This webservice is supposed to serve a mobile app and also a website (located on the same server/virtualhost/whatever).
For example, URLs will be something like:
- http://www.somedomain.com/API/ (RESTful webservice)
- http://www.somedomain.com/ (WebSite, which will fetch data from the same sources that the webservice uses).
Now my question is:
Which type of query is the most recommended for querying the database? For example, if I login from the website (http://www.somedomain.com/), it would be better to implement another internal PHP API for that or to login using cURL to the REST API and why?
I know, if I implement another PHP function for login from the website, I will be using one less HTTP connection to my server, but wouldn't it break the idea of the RESTful API?
Thank you in advance.