0
Hello,
Only the zip code search to find the city and state works, but the city and state search [and neighborhood] to find the zip code does not work because in JSON, the zip code variable ($result->cep) is within the keys of the numerical class and there is no city-state class. 
Eis in PHP:
if ($_SERVER['REQUEST_METHOD'] === 'POST') 
{
 function webClient($url)
 {
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     $data = curl_exec($ch);
     curl_close($ch);
     return $data;
 }
 $descubra = $_POST['descubra'];
 switch ($descubra)
 {
  case "lugar":
   $cidade = $_POST['cidade'];
   $estado = $_POST['estado'];
   $bairro = $_POST['bairro'];
   $url = sprintf('https://viacep.com.br/ws/%s/%s/%s/json/ ', $estado, $cidade, $bairro);
   $result = json_decode(webClient($url));
   echo $result->cep;
   break;
  case "ceplocal":
   $cep    = $_POST['cep'];
   $url = sprintf('https://viacep.com.br/ws/%s/json/ ', $cep);
   $result = json_decode(webClient($url));
   echo $result->localidade;
   echo $result->uf;
   break;
  default:
    echo "Inválido!";
 }
}
						
I also use the Open ZIP code and observe that it does not have
array. Verifies: https://repl.it/@Gustavo_benedit/Naoexistearraynocepaberto.– Gustavo Reis