Open Analytics Protocol Draft #2

A php page that outputs only ONCE the following tag:

Closed by:

Between those two html tags one should output one of the following:

The website shall receive by POST METHOD the following:
Tag Name, the name of the tag being request $_POST[“tag_name”]
-If this field doesn’t match the tag a page is supposed to output, one shall output ERROR
Data Url, the link to the data to be analyzed $_POST[“data_url”]



<form action=”AnalyticsSubPage.php” method=”post”>
<input type=”text” name=”tag_name”>
<input type=”text” name=”data_url”>
<input type=”submit”>


if ($_POST[“tag_name”]==”English”)
$raw_page= file_get_contents($_POST[“data_url”]);
$stripped_page= strip_tags($raw_page);
$freq_ar= count_chars($stripped_page);

$en_letter= $freq_ar[ord(“t”)]+$freq_ar[ord(“T”)];
$ot_letter= $freq_ar[ord(“r”)]+$freq_ar[ord(“R”)];

if ($en_letter>$ot_letter)
foreach ($freq_ar as $char_code=>$freq)
echo $char_code.”, “.chr($char_code).”: “;
echo $freq.”<br />”;






Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s