alexarpad2003 Posted December 2, 2010 Report Posted December 2, 2010 Am asa : <?php function get_euro() { $tgt='http://www.bancatransilvania.ro/istoric_valuta.php?limba=0&valuta=2'; @$x=file_get_contents($tgt,'FILE_TEXT',NULL,0,1250); @$x_exp=explode('<td>',$x); @$x2=explode(' ',$x_exp[7]); @$x_final=explode('>',$x2[10]); @$EUR=(float)$x_final[1]; return $EUR; }?>Asi dori sa-mi returneze cursul de la bnr din pagina Banca Transilvania .O idee ? Quote
Vlachs Posted December 2, 2010 Report Posted December 2, 2010 pai de acolo vad ca iti ia da nu stiu daca parametri pentru explode sunt corecti Quote
alexarpad2003 Posted December 2, 2010 Author Report Posted December 2, 2010 Deci functia asta merge bine, mi-a facut-o cineva, insa eu vreau sa o modific si sincer imi prind urechile in ea. Quote
jesus Posted December 2, 2010 Report Posted December 2, 2010 (edited) ti-o fac eu. revin cu un edit.edit:<?phpfunction get_string_between($string, $start, $end){ $string = " xxx".$string."zzz"; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len);}$x = file_get_contents('http://www.bancatransilvania.ro/istoric_valuta.php?limba=0&valuta=2','FILE_TEXT',NULL,0,1250 );$cursuri = explode("</td><td valign=middle class=\"scris_12\">",$x);$curs = $cursuri[2];$cumparare = $cursuri[3];$vanzare = get_string_between($cursuri[4], "xxx", "</td></tr><tr><td>");echo $curs ." - ". $cumparare ." - ". $vanzare;?> Edited December 2, 2010 by jesus Quote