title: connect to php API from php website
body: <p>I'm quite new to PHP. As a learning project, I'm currently building a website on which users can order products. </p>
  
  <p>I don't want my website to connect to the database I have directly, but I want that process to go through an API I've made. The API has a quite simple structure: the index.php receives the call and the variables (through post) and then, depending on the type of data received, runs one of the functions in one of it's controllers.</p>
  
  <p>So, the question:
  <strong>How do I set up a connection between my website and my php api (on the same server) to access my database?</strong></p>
  
  <p>I have searched the web and SO for API connections but most of the questions are about the FB API and oAuth etcetera. If I have missed a similar question please inform me because then I'll delete this question.</p>
  
  <p>Any help would be much appreciated, Thank you in advance!</p>