Created
October 10, 2012 20:22
-
-
Save enapupe/3868183 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function s1mp_cep($cep) { | |
try { | |
$get = file_get_contents("http://cep.s1mp.net/" . $cep); | |
} catch (Exception $e) { | |
return false; | |
} | |
if ($json = json_decode($get)) { | |
if ($json->result === true) { | |
return array('cidade' => $json->data->cidade, 'uf' => $json->data->uf, 'logradouro' => $json->data->logradouro, 'bairro' => $json->data->bairro, 'tp_logradouro' => $json->data->tp_logradouro);>tp_logradouro); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment