I want to find away out to obtain all Apache running request in a given moment. I have to list the vhost, cpu, request ip plus some additional information. This article be consumed with a PHP script.

I've mod_status installed and contains all the details I want. And So I attempted to make use of file_get_contents to obtain the report, producing a request in the server (http://localhost/server-status). It labored perfectly. I Quickly attempted to parse the report, transforming it to XML using simplexml_load_string. However , the HTML outputted by mod_status isn't well created.

This is actually the HTL in the table I have to parse:

<table border="0"><tr><th>Srv</th><th>PID</th><th>Acc</th><th>M</th><th>CPU

</td><td></td><td nowrap>zsce</td><td nowrap>OPTIONS * HTTP/1.0</td></tr>

</td><td></td><td nowrap>zsce</td><td nowrap>OPTIONS * HTTP/1.0</td></tr>


I am sure someone has attempted to behave such as this before. 1) Can there be a different way to access the data I want? 2) Has anybody attempted other tools / modules?

Thanks ahead of time.

I can not begin to see the trouble with the HTML. Wrong by using it?

Does PHP not have access to a liberal HTML parser something similar to Python's BeautifulSoup or Ruby's Nokogiri?

Also, keep in mind that mod_status has 'auto' way of creating machine-readable output.

http://www.apache.org/server-status?auto http://httpd.apache.org/paperwork/2.2/mod/mod_status.html#machinereadable

I simply discovered that basically remove "nowrap" in the HTML before parsing it, it really works.