sofTKiller Posted August 31, 2004 Report Share Posted August 31, 2004 kaads nezinaatu kaadu skriptu, kas paraadiitu LR Banka's valuutu un laika zinjas Latvijai? :unsure: Link to comment Share on other sites More sharing options...
Venom Posted September 1, 2004 Report Share Posted September 1, 2004 parād' tikai izejkodu/xml, gan jau kauko izštukosim Link to comment Share on other sites More sharing options...
Kaklz Posted September 1, 2004 Report Share Posted September 1, 2004 bankas valūtu kursus var dabūt viņu lapā: http://www.bank.lv/vk/xml.xml Reiz sensenos laikos, kad man nebija pieejams ne SimpleXML, ne xml saimes funkcijas uzrakstīju pāris funkcijas: <?php function valuta($kods){ $str = file('http://www.bank.lv/vk/xml.xml'); $str = join('', array_slice($str, 4, count($str) - 7)); $str = str_replace("\n", '', $str); $str = str_replace("\r", '', $str); $str = preg_replace("/[\t]*/", '', $str); $str = preg_replace("/[ ]*/", '', $str); $str = str_replace('<Currency><ID>', '', $str); $str = str_replace('</ID><Units>', '-', $str); $str = str_replace('</Units><Rate>', '-', $str); $str = str_replace('</Rate></Currency>', "\n", $str); $valutas = explode("\n", $str); foreach ($valutas as $valutaItem){ $valutaInfo = explode('-', $valutaItem); $valutasListe[$valutaInfo[0]] = $valutaInfo[1] . $valutaInfo[0] . ' maksaa Ls ' . ($valutaInfo[2] * 1); } return $valutasListe[$kods]; } function listvaluta(){ $str = file('valuta.xml'); $str = join('', array_slice($str, 4, count($str) - 7)); $str = str_replace("\n", '', $str); $str = str_replace("\r", '', $str); $str = preg_replace("/[\t]*/", '', $str); $str = preg_replace("/[ ]*/", '', $str); $str = str_replace('<Currency><ID>', '', $str); $str = str_replace('</ID><Units>', '-', $str); $str = str_replace('</Units><Rate>', '-', $str); $str = str_replace('</Rate></Currency>', "\n", $str); $valutas = explode("\n", $str); foreach ($valutas as $valutaItem){ $valutaInfo = explode('-', $valutaItem); $valutasListe[] = $valutaInfo[0]; } return 'reku sheku, man ir shitaadi valuutas kursi: ' . join (', ', $valutasListe) . '. Ko vinji katrs noziimee, gan man neprasi :P'; } ?> Link to comment Share on other sites More sharing options...
Venom Posted September 1, 2004 Report Share Posted September 1, 2004 Specifiskāks, bet, domājams, ātrāks piemērs: $text=@implode('',@file('http://www.bank.lv/vk/xml.xml')); if (!$text) die('Banka nav publicējusi šodienas kursus'); $text=str_replace('<Currency>','#',$text); $text=strip_tags($text); $text=explode('#',$text); $els=count($text); unset($text[0]); $currencies=array(); while(--$els) { $lines=explode("\n",trim($text[$els])); $currencies[trim($lines[0])]=array(trim($lines[1]),trim($lines[2])); } echo 'Amerikas dolāru kurss ir '.$currencies['USD'][1].' Ls par '.$currencies['USD'][0].' valūtas vienību.'; print '<pre>'.print_r($currencies,1).'</pre>'; Link to comment Share on other sites More sharing options...
bubu Posted September 1, 2004 Report Share Posted September 1, 2004 XMLs vispār izrādās iekš php ir baigā bremze: http://php.weblogs.com/discuss/msgReader$3290 Link to comment Share on other sites More sharing options...
Kaklz Posted September 1, 2004 Report Share Posted September 1, 2004 Ja ir pieejams SimpleXML, tad tas kljuust pavisam triviaali <?php $xmlstr = file_get_contents('xml.xml'); $xml = simplexml_load_string($xmlstr); $currencyList = $xml -> body -> crates -> currencies -> currency; foreach ($currencyList as $currencyItem){ echo $currencyItem -> id . $currencyItem -> units . $currencyItem -> rate . "<br />"; } ?> Link to comment Share on other sites More sharing options...
sofTKiller Posted September 3, 2004 Author Report Share Posted September 3, 2004 thx! bet kaa buutu ar laika zinjaam? (skripts, kas paraadiitu laika zinjas Latvijaa) Link to comment Share on other sites More sharing options...
Venom Posted September 6, 2004 Report Share Posted September 6, 2004 nu tad rodi laiku sourcus Link to comment Share on other sites More sharing options...
AJIEKCAHDP Posted September 23, 2004 Report Share Posted September 23, 2004 :angry: Hmm, interesnya i aktualojnaya tema, no dokonca ona ne raskrita! Hotelosj bi videtj skript prognoza pogodi! :blink: Link to comment Share on other sites More sharing options...
Venom Posted September 23, 2004 Report Share Posted September 23, 2004 nu tad rodi laiku sourcus нефиг злиться смайликами - давай сюда какой-либо ресурс прогнозов погоды Link to comment Share on other sites More sharing options...
AJIEKCAHDP Posted September 23, 2004 Report Share Posted September 23, 2004 :rolleyes: Nu sam naprosilsza! Ö= MetioResursi: AccuWeather Travelocity USA TODAY weather.com wunderground.com Yahoo! Weather Ja hotel bi chto bi ti prodemostriroval bi skript kak zdelan na www.pilsetas.lv! Tam klassno zdelano, hotelosj bi poimetj takoj zhe! Link to comment Share on other sites More sharing options...
bubu Posted September 23, 2004 Report Share Posted September 23, 2004 (edited) Biku neizprotu tavu problēmu, AJIEKCAHDP. Pats iedevi pie tam kautkādus nosaukumus, nevis konkrētu linku(s) no kurienes ņemt laika ziņas. Vari kautvai no šī paša www.pilsetas.lv ņemt, ja jau tas patīk. Tik ņem un cel augšā skriptu. Edited September 23, 2004 by bubu Link to comment Share on other sites More sharing options...
sofTKiller Posted September 26, 2004 Author Report Share Posted September 26, 2004 te nu buus pats laika zinju kods, bet tas ir tikai Liepaajai! <_< starp citu kaads laikam prasiija par resursiem... nu luuk: http://gismeteo.ru/ pats kods: <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID="fobos" WIDTH="105" HEIGHT="51"> <param name="movie" value="http://img.gismeteo.ru/flash/fw120x60.swf?index=26406&lang=en">'>http://img.gismeteo.ru/flash/fw120x60.swf?index=26406&lang=en"> <param name="quality" value="high"> <param name="bgcolor" value="#FFFFFF"> <param name="menu" value="false"> <param name="scale" value="exactfit"><embed src="http://img.gismeteo.ru/flash/fw120x60.swf?index=26406&lang=en" quality="high" bgcolor="#FFFFFF" WIDTH="120" HEIGHT="60" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </object> Link to comment Share on other sites More sharing options...
bubu Posted September 26, 2004 Report Share Posted September 26, 2004 ak dies, flashs, pē ;P Link to comment Share on other sites More sharing options...
sofTKiller Posted October 3, 2004 Author Report Share Posted October 3, 2004 kaadu tad tev vajag? texta vai gif? Link to comment Share on other sites More sharing options...
Recommended Posts