21 comentários

  1. Rogerio

    Muito boa sua video aulas, sempre atualizado. Valeu pela dica.

  2. Alexandre Azevedo

    Muito Rafael, gostei muito e mim trouce para ideias para meus futuros sistemas. vlw pela contribuição de tempo e conhecimento.

  3. Luis Gustavo

    Olá…Sou um dos criadores do blog bsdinfo e estava procurando matérias sobre Php. Sinceramente vc está de Parabéns. Estou terminando curso de Php na 4Linux e acabei encontrando seu blog. Virou referência.

    Parabéns…

  4. bruno

    Muito bacana rafael.
    Bastante prático e didático!

  5. João Coelho

    Meu código ta dando uma porrada de erros: Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:1: parser error : Space required after the Public Identifier in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:1: parser error : SystemLiteral ” or ‘ expected in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:1: parser error : SYSTEM or PUBLIC, the URI is missing in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:19: parser error : Opening and ending tag mismatch: hr line 17 and body in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:19: parser error : Opening and ending tag mismatch: body line 4 and html in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://wbsr.desolhotsasa.com.br/index.php?id=1:20: parser error : Premature end of data in tag html line 2 in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: in /home/desolhots/public_html/acessar.php on line 2

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/desolhots/public_html/acessar.php on line 2

  6. João Coelho

    Tentei acessar direto sem o arquivo acessar.
    E da como se o index.php estivesse corrompido. Não sei mesmo o que pode ser .

  7. Urbano

    Olá rafael, uma dúvida, onde que entra aí no caso do webservice, o soap? por ex. andei olhando alguns exemplos com o soapserver e soapcliente; seria uma alternativa?
    grato

  8. Daniel Pereira Barros dos Santos

    Boa tarde Rafael!

    Estou fazendo meu TCC e vi suas aulas para criar um web service.

    Tive um problema, entrando na página acessar.php, ele dá esse erro:

    Warning: simplexml_load_file(): http://localhost/PhpProject1/index1.php?id=2:2: parser error : Start tag expected, ‘<' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PhpProject1\acessar.php on line 3 Warning: simplexml_load_file(): Notice: Undefined property: stdClass::$nome in C:\Program Files\Apache Software in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PhpProject1\acessar.php on line 3 Warning: simplexml_load_file(): ^ in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\PhpProject1\acessar.php on line 3

    Tentei resolver aqui, mas não consegui…

    O que pode ser este erro?

  9. Rodrigo

    O meu dá o mesmo erro do Daniel, na linha 3 do “acessar.php”
    :/

  10. Rodrigo

    Olha o código
    XML
    xml .= “\n” ;
    }

    public function openTag($name){
    $this->addTab();
    $this->xml .= “\n”;
    $this->tab++;
    }

    public function closeTag($name){
    $this->tab–;
    $this->addTab();
    $this->xml .= “\n”;
    }

    public function setValue($value){
    $this->xml .= “$value\n”;
    }

    private function addTab(){
    for($i = 1; $i tab; $i++){
    $this->xml .= “\t”;
    }
    }

    public function addTag($name, $value){
    $this->addTab();
    $this->xml .= “$value\n”;
    }

    public function __toString() {
    return $this->xml;
    }
    }

    ?>

    INDEX
    openTag(“response”);

    if($idproduto == ”){
    $erro = 1;
    $msgerro = ‘Código inválido!’;
    }
    else{
    $rs = mysql_query(“SELECT * FROM produtos WHERE id = $idproduto”);
    if(mysql_num_rows($rs) > 0){
    $reg = mysql_fetch_object($rs);
    $xml->addTag(‘nome’, $reg->nome);
    $xml->addTag(‘preco’, $reg->preco);
    }else{
    $erro = 2;
    $msgerro = “Produto não encontrado”;
    }
    }
    $xml->addTag(‘erro’, $erro);
    $xml->addTag(‘msgerro’, $msgerro);

    $xml->closeTag(“response”);

    echo $xml;

    ?>

  11. Rodrigo

    não foi o código todo! :/

  12. Rodrigo

    Cara pois mande seu projeto para o meu email, pq não consegui, deu o mesmo errinho!!
    fufufu.. Deve ser uma coisa bem besta e não percebo o q é..!

  13. Rodrigo

    Tem como mandar Rafael?

  14. Josemberg

    Parabéns pelo o bem explicado tutorial, você só equivocou e por isso gerou erro para todos, na linha abaixo:
    mysql_query(“SELECT * FROM nome_da_tabela WHERE id = $idproduto”);

    Faltou o $rs no qual você faz a referência para a quantidade de linhas afetadas(mysql_num_rows($rs)) então corrigido fica assim:

    $rs = mysql_query(“SELECT * FROM nome_da_tabela WHERE id = $idproduto”);

    Um abraço

Deixar um comentário