Skip to content

Instantly share code, notes, and snippets.

@enapupe
Created October 10, 2012 20:22
Show Gist options
  • Save enapupe/3868183 to your computer and use it in GitHub Desktop.
Save enapupe/3868183 to your computer and use it in GitHub Desktop.
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