Forked from camilamoreiradev/Pegar dados da empresa
Created
February 3, 2023 06:28
-
-
Save notelseit/8784a162c7a346d3b9258ea62e23679e 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