How to monitor bandwidth consumption of a user in PHP
<p>Ok I know this is a weird problem and may not be possible, so ideas would be appreciated.</p>

<p>Anyways, I want to find out how much bandwidth I am giving to each user. I identify a user when he logins to the website.</p>

<p>So basically for every request, I want to know how much bandwidth was used by that request. And if a user was logged in at that time, I will add the amount to his account.</p>

<p>Will be using codeigniter, though I doubt that makes a difference.</p>

<p>Everything will be on the same Linux based server with Apache, for now at least. </p>

<p>Ideally I'd like a solution that's not limited to the type of hosting. </p>

<p>Will be using either Google cloud or amazon AWS. If the solution is limited to google cloud or aws, it will work.</p>