Como posso pegar os resultados das loterias com PHP?
[code language=”php”]<?php // Leitura de resultados da mega-sena // Autor: Paulo Costa // URL: http://www1.caixa.gov.br/loterias/_arquivos/loterias/D_megase.zip $contents = file_get_contents(‘megasena.htm’); $doc = new DOMDocument(); @$doc->loadHTML($contents); $lint_sorteioRowspan = 2; $tags = $doc->getElementsByTagName(‘tr’); $larr_sorteios = array(); foreach ($tags as $tag) { $lint_sorteioRowspan –; if ( $lint_sorteioRowspan == 0 ) { $lstr_sorteioNumero = $tag->getElementsByTagName(‘td’)->item(0)->nodeValue; $lint_sorteioRowspan = $tag->getElementsByTagName(‘td’)->item(0)->getAttribute(‘rowspan’); $larr_sorteio[‘Data’] = $tag->getElementsByTagName(‘td’)->item(1)->nodeValue; …
Como posso pegar os resultados das loterias com PHP? Leia mais »