Created
January 19, 2019 21:00
-
-
Save rcarvs/585b7fa95d9a2db65d0daf1431f3d7bf to your computer and use it in GitHub Desktop.
Verifica se determinado CPF é servidor público federal ou não consultando o portal da transparência.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @author carvs | |
*/ | |
$cpf = "12345678912"; | |
$url = "http://transparencia.gov.br/servidores/Servidor-ListaServidores.asp?bogus=1&Pagina=1&TextoPesquisa=".$cpf; | |
$opts = array('http' => | |
array( | |
'method' => 'GET', | |
'timeout' => 20 | |
) | |
); | |
$context = stream_context_create($opts); | |
$retorno = file_get_contents($url, false, $context); | |
$explode = explode(' ',$retorno); | |
$servidor = false; | |
if(!in_array("encontrados", $explode)){ | |
$servidor = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment