Patrick,<br><br>Dentro do while, use a função strpos do php.<br><br>Abs<br><br>Sylvio Jollenbeck<br><br><div class="gmail_quote">2012/11/1 Patrick EL Youssef <span dir="ltr">&lt;<a href="mailto:wushumasters@gmail.com" target="_blank">wushumasters@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
    Pessoal,<br>
    <br>
    Quem mexe bem com o manager e puder me ajudar. Estou executando
    comando &quot;sip show peers&quot; via php porém ele me retorna sempre as
    mensagens do proprio manager junto do comando:<br>
    <br>
    
    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Asterisk Call Manager/1.2<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Response: Success<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Message: Authentication accepted<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Event: FullyBooted<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Privilege: system,all<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Status: Fully Booted<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Response: Follows<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Privilege: Command<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Name/username Host Dyn Forcerport ACL Port Status
      Description Realtime<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">2000/2000 (Unspecified) D N A 0 UNKNOWN<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">2001/2001 192.168.1.131 D N 5060 UNREACHABLE<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">2</span><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px"> sip peers [Monitored: 0 online, 2 offline Unmonitored: 0
      online, 0 offline]<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">--END COMMAND--<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Response: Goodbye<span> </span></span><br style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">

    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;display:inline!important;font-weight:normal;float:none;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:&#39;Times New Roman&#39;;word-spacing:0px">Message: Thanks for all the fish.<span> </span></span><br>

    <br>
    Tem como eu só pegar a saída do comando mesmo. Meu código php é
    esse:<br>
    <br>
    $socket = fsockopen(&quot;127.0.0.1&quot;,&quot;5038&quot;, $errno, $errstr, 10);<br>
        if (!$socket) {<br>
            echo &quot;$errstr ($errno)\n&quot;;<br>
        } else {<br>
                    fputs($socket, &quot;Action: Login\r\n&quot;);<br>
                    fputs($socket, &quot;UserName: usuario\r\n&quot;);<br>
                    fputs($socket, &quot;Secret: senha\r\n\r\n&quot;);<br>
    <br>
                    fputs($socket, &quot;Action: Command\r\n&quot;);<br>
                    fputs($socket, &quot;Command: sip show peers\r\n\r\n&quot;);<br>
                    fputs($socket, &quot;Action: Logoff\r\n\r\n&quot;);<br>
                <br>
        while (!feof($socket)) {<br>
                       echo fgets($socket),&#39;&lt;br&gt;&#39;;<br>
                }<br>
                <br>
            fclose($socket);<br>
                }<br>
    <br>
    Obrigado,<br>
    Patrick<br>
  </div>

<br>_______________________________________________<br>
KHOMP Inovação: External Board Series<br>
Módulos de 1/2 rack e 1U para todas as interfaces e soluções Asterisk e FreeSWITCH.<br>
Tenha a External Series Experience na sua aplicação. Visite <a href="http://www.khomp.com" target="_blank">www.khomp.com</a><br>
_______________________________________________<br>
DIGIVOICE  Fabricante de Placas de Voz e Channel Bank<br>
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM<br>
Centro Treinamento - Curso de PABX IP -  Asterisk  - Site  <a href="http://www.digivoice.com.br" target="_blank">www.digivoice.com.br</a><br>
________<br>
YEALINK: Telefones IP e VídeoPhones IP com o melhor custo/benefício do mercado.<br>
email: <a href="mailto:yealink@commlogik.com.br">yealink@commlogik.com.br</a> | <a href="http://www.commlogik.com.br" target="_blank">www.commlogik.com.br</a> | (11) 5503-1011<br>
______________________________________________<br>
Para remover seu email desta lista, basta enviar um email em branco para <a href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a><br></blockquote></div>
<br>