Total Firefox download!
Here is a quick script to get the total Firefox downloads from it rss feed:
include(”../files/fire.php”);
?>
PHP 4 test script
PHP 5 test script
Here is a quick script to get the total Firefox downloads from it rss feed:
include(”../files/fire.php”);
?>
PHP 4 test script
PHP 5 test script
October 19th, 2005 at 10:51 am
ok great !
trying it now in my website
Thanks a lot for the good work !
October 22nd, 2005 at 10:06 am
u welcome!
November 9th, 2005 at 5:02 am
A multi lingual version from mag3ee . Thanks to mag2ee
PHP:
—————————————————————-
// http://www.pixelcutter.com/log/?p=2
// Modify: mag3ee ( at gmail dot com )
// + Multilanguage (:-Đ)
// + Number format function
// + Style span
$tag = ”;
$inside =0;
$file = ‘i:\\www\\source\\firefox.xml’;
$file =”http://feeds.spreadfirefox.com/downloads/firefox.xml”;
$your_lang = ” FireFox letöltések”; // Hun
$your_lang = ” FireFox Downloads”; // Eng
// $your_lang = ” FireFox ???”; // Your other lang (Sorry my english :-)
function startElement($parser, $name, $attrs)
{
global $tag, $inside;
if( $name == ‘PUBDATE’ ){
$tag = $name;
}
if( $name == ‘ITEM’ )
$inside = 1;
if ($inside == 1)
if( $name == ‘DESCRIPTION’)
$tag = $name;
}
function endElement($parser, $name)
{
global $tag, $inside;
$tag= ”;
if($name == ‘ITEM’)
$inside = 0;
}
function characterData($parser, $data)
{
global $tag,$inside;
if ($tag == ‘PUBDATE’){
// echo $data . ”;
}
if ($inside ==1 and $tag== ‘DESCRIPTION’) {
echo ” $your_lang: “. geld($data)
.”";
}
}
if (!($fp = fopen($file, “r”))) {
die(”could not open XML input”);
}
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, “startElement”, “endElement”);
xml_set_character_data_handler($xml_parser, “characterData”);
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf(”XML error: %s at line %d”,
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
}
xml_parser_free($xml_parser);
// geld(123) >>> 123
// geld(123456) >>> 1.234.567
// + Number format string (http://hu.php.net/manual/hu/function.number-format.php) by kolnedra at gmail dot com
function geld($nm) {
for ($done=strlen($nm); $done > 3;$done -= 3) {
$returnNum = “.”.substr($nm,$done-3,3).$returnNum;
}
return substr($nm,0,$done).$returnNum;
}
January 30th, 2006 at 7:29 am
Thanks! I’ve been trying to make exactly this, saved me loads of trouble :)
March 17th, 2006 at 10:49 am
[...] A neat counter using PHP is here inserted alongwith some text effortlessly and php code posted here. Another quick script to get the total Firefox downloads from it rss feed. More code about creating a php page and using with iframes. [...]