How to Retriev File Statistic in PHP
I am looking for a PHP website statistics script, one that uses php which includes to gather visitor information, I hope this is possible and if this is possible then i can use in my daily routine, so please suggest me does something like this exist?
Thanks for your reply.
Re: How to Retriev File Statistic in PHP
To analyze XML documents, you can install and use the XML_Statistics package, which provides methods for obtaining statistics about tags, attributes, entities, processing instructions, data blocks, and CDATA sections for any well-formatted XML document.
To install the PEAR, use this command (version 0.1 is the beta version):
-> pear install -alldeps XML_Statistics-0.1
XML document used for test purposes in the example code.
The following PHP example uses the XML document in Listing 1 to retrieve some basic statistics about tags, attributes, and CDATA sections:
PHP Code:
<?php
//import Statistics.php
require_once 'XML/Statistics.php';
//ignore whitespaces
$stat = new XML_Statistics(array("ignoreWhitespace" => true));
//analyze a file or URL
$result = $stat->analyzeFile("myxml.xml");
if ($stat->isError($result)) {
die("Error: " . $result->getMessage());
}
else
{
// total number of tags
echo "Total tags: " . $stat->countTag()."<br>";
// count number of 'type' attribute
echo "Occurences of attribute type: " . $stat->countAttribute("type")."<br>";
// get the maximum depth
echo "Maximum depth: " . $stat->getMaxDepth()."<br>";
// count total number of tags in depth 3
echo "The number of tags in depth 3: " . $stat->countTagsInDepth(3)."<br>";
// count the occurences of data blocks
echo "Data chunks: " . $stat->countDataChunks()."<br>";
// get the length of all CData sections
echo "Length of all data chunks: " . $stat->getCDataLength()."<br>";
}
?>
The output of this example is:
Total tags: 16
Occurences of attribute type: 2
Maximum depth: 3
The number of tags in depth 3: 10
Data chunks: 6
Length of all data chunks: 93
Re: How to Retriev File Statistic in PHP
PHP website Usage Statistics script is used to view the number of hits made by online customers, number of clicks per page, their IP address, unique customers IP address, search engine tracking(Google) and referer site etc., These informations will be shown in numerical value through MySQL database.