Created
March 5, 2020 19:17
-
-
Save camilamoreiradev/9cdb5b27fd3187fd9ae6e93110ea7074 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
$cnpj = {cnpj}; | |
$webservice = "https://www.receitaws.com.br/v1/cnpj/".$cnpj; | |
$consulta = file_get_contents($webservice); | |
$retorno = json_decode($consulta,true); | |
if($retorno["status"] == "OK") { | |
if($retorno["situacao"] == "ATIVA") { | |
{razao_social} = $retorno["nome"]; | |
{nome_fantasia} = $retorno["fantasia"]; | |
{cep} = str_replace(".", "", str_replace("-", "", $retorno["cep"])); | |
{endereco} = $retorno["logradouro"]; | |
{numero} = $retorno["numero"]; | |
{complemento} = $retorno["complemento"]; | |
{bairro} = $retorno["bairro"]; | |
{cidade} = $retorno["municipio"]; | |
{estado} = $retorno["uf"]; | |
{telefone} = str_replace("(", "", str_replace(")", "", str_replace("-", "", $retorno["telefone"]))); | |
{email} = $retorno["email"]; | |
} else { | |
sc_alert("Empresa inativa!"); | |
} | |
} else { | |
sc_alert($retorno["message"]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
como seria se eu precisar passar algum parâmetro (usuário e senha, algum filtro)? no postman é no body.