repl.it
@m_s__santos/

obtendo-taxa-cdi

PHP (Legacy)

Buscando a taxa de CDI atualizada com PHP.

fork
loading
main.php
1
2
3
4
5
$today = date("Ymd", time() - 86400);
$cdi = trim(file_get_contents("ftp://ftp.cetip.com.br/MediaCDI/".$today.".txt"));
$cdi = substr_replace($cdi, '.', -2, 0);
$cdi = $cdi / 100;
echo $cdi;
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7