Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] showing stocks onscreen



Hi all,

just a little PHP script for showing your favorite stocks in VDR
by the commands.conf (just an example, I'm not responsible when you
loose money)
Run it like <pathname>/php -q <scriptname>

Cheers
Manfred

Script:(Maybe you have to reasemble some lines...)


<?php

$AKTIEN = array ("abit",
		 "Agilent",
		 "cla",
		 "cew2",
		 "cfa",
		 "evt",
		 "hwp",
		 "lbc",
		 "pxn",
		 "sap"
		 );
$search = array ("'<script[^>]*?>.*?</script>'si",  // Strip out javascript
		 "'<br>'si",
                 "'<[\/\!]*?[^<>]*?>'si",           // Strip out html tags
                 "'([\r\n])[\s]+'",                 // Strip out white space
                 "'&(quot|#34);'i",                 // Replace html entities
                 "'&(amp|#38);'i",
                 "'&(lt|#60);'i",
                 "'&(gt|#62);'i",
                 "'&(nbsp|#160);'i",
                 "'&(iexcl|#161);'i",
                 "'&(cent|#162);'i",
                 "'&(pound|#163);'i",
                 "'&(copy|#169);'i",
                 "'&#(\d+);'e",                     // evaluate as php
                "'[\n]'",
                "'[\r]'s");

$replace = array ("",
                  "|",
                  "",
                  "\\1",
                  "\"",
                  "&",
                  "<",
                  ">",
                  " ",
                  chr(161),
                  chr(162),
                  chr(163),
                  chr(169),
                  "chr(\\1)",
                  "|",
                  "|");


$Headline=sprintf("\n%s %s %s\n","  Aktien  ","akt.Kurs","Diff(%)");
$diffline=sprintf("%s\n","----------------------------");
echo $Headline;
echo $diffline;
foreach ($AKTIEN as $KURS)
{
	$fp = fopen
('http://deuba.teledata.de/deuba/search/searchswitch.html?searchfor='.$KURS.
'&searchforb=2&searchforicat=5','r');

	$content = fread ( $fp, 1000000 );

	$text = preg_replace ($search, $replace, $content);
	$list = split("\|",$text);
	$zeile = sprintf("%s %4.3f
%4.3f\n",substr($list[21],0,10),$list[22],$list[25]);
	echo $zeile;
	fclose($fp);
}
echo $diffline;

?>


-------                   Manfred Schmidt-Voigt                  -------
-----                  Günzweg 10, 22393 Hamburg                   -----
-----                                                              -----
-------          mailto:manfred.schmidt-voigt@mannitec.de         -------



-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index