skip to Main Content

i have server ubuntu . I want to show network traffic upload & download in php .

A command is in the terminal for monitoring traffic: enter link description heregg

How can I use command nload -mon php.
Like this :
s

i have no idia about it

2

Answers


  1. The simplest solution is:

    1. to call this function in PHP file via exec().
    2. to parse the output from this function and prepare the markup to present those values (total input/output) on the page.

    Better solutions depend on how often this info should be retrieved and how pretty it should be rendered in the browser.

    Login or Signup to reply.
  2. It compiles php to apache and apache simply does not access network uses. There are several ways for this;

    1-) shell_exec;

    In ubuntu you can prepare a console command that will output the network data as json, then you can run this console command in ubuntu using shell_exec in php.

    2-) third part programming;

    For example, you can develop scripts on platforms such as python, node js, etc. and access network usage. Again, with the software you have developed, you can instantly print the network usages to the database. In another option, you can access network information with software such as phton and show them on socket, and you can get data from php with socket. Finally, you can develop an api for this on pyhton.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search