-4
What is missing for this code bring the result of the zip code ?
<!DOCTYPE html>
<!--<! -- Trazer Resultados CEP, Rua, Bairro e Estado -->
<html lang="pt-br"> <!-- Declaração do Idioma  -->
    <head>
        <meta charset="UTF-8">
        <title> MEU CEP </title>
    <label> Insira o CEP: </label>
    <input type="text" name="cep"> 
    <input type="submit" value="Enviar"> <br />
    <label>Rua:
        <input name="rua" type="text" id="rua" size="60" /></label><br />
    <label>Bairro:
        <input name="bairro" type="text" id="bairro" size="40" /></label><br />
    <label>Estado:
        <input name="uf" type="text" id="uf" size="2" /></label><br />
    <?php
    if (!empty($_POST['cep'])) {
        $cep = $_POST['cep'];
        $address = (get_address($cp));
        echo "<br><br>CEP Informado: $cep<br>";
        echo "Rua: $addres->logradoro<br>";
        echo "Bairro: $address->bairro<br>";
        echo "Estado: $adress->uf<br>";
    }
    function get_address($cep) {
        $cep = preg_replace("/[^0-9]/", "", $cep);
        $url = "http://viacep.com.br/ws$cep/xml/";
        $xml = simplexml_load_file($url);
        return $xml;
    }
    ?>
</body>
</html>I made a new version with corrections and inserted the class Address , but is not yet returning to Street, Neighborhood and State
<!DOCTYPE html>
<!--<! -- Trazer Resultados CEP, Rua, Bairro e Estado -->
<html lang="pt-br"> <!-- Declaração do Idioma  -->
    <head>
        <meta charset="UTF-8">
        <title> MEU CEP </title>
    <label> Insira o CEP: </label>
    <input type="text" name="cep"> 
    <input type="submit" value="Enviar"> <br />
    <label>Rua:
        <input name="rua" type="text" id="rua" size="60" /></label><br />
    <label>Bairro:
        <input name="bairro" type="text" id="bairro" size="40" /></label><br />
    <label>Estado:
        <input name="uf" type="text" id="uf" size="2" /></label><br />
    <?php
    if (!empty($_POST['cep'])) {
        $cep = $_POST['cep'];
        $address = (get_address($cep));
        echo "<br><br>CEP Informado: $cep <br>";
        echo "Rua: $addres->logradoro<br>";
        echo "Bairro: $address->bairro<br>";
        echo "Estado: $address->uf<br>";
    }
    class Address {
        public $bairro;
        public $logradouro;
        public $uf;
        function get_address($cep) {
            $url = "http://viacep.com.br/ws/" . $cep . "/xml";
            $xml = simplexml_load_file($url);
            $this->bairro = $xml->bairro;
            $this->logradouro = $xml->logradouro;
            $this->uf = $xml->uf;
        }
    }
    ?>
</body>
</html>
Welcome Raquel Gomes, if any answer solves your problem mark it as accepted. See how in https://i.stack.Imgur.com/jx7Ts.png and why in https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252
Take a tour https://answall.com/tour
– user60252