Re: Getting PHP to process input from STDIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 24, 2016 at 12:40 PM, Danny <mynixmail@xxxxxxxxx> wrote:

> Hi,
>
> I am trying to process the body of a message that is piped from Procmail
> to a
> php-cli script with no luck ... I am trying to only catch the body of the
> message ... no other formatting ... mime etc ... only the body which
> consists of
> a one line message that is max 96 characters long ... the message in the
> body
> will start with a 0(zero) and end with a 0(zero) ...
>
> Here is my script:
>
> ######################################################################################################
> #!/usr/bin/php
> <?php
>   $get_mail_body = fopen ( 'php://stdin', 'r' ) ;
>   $mail_body = preg_match ( "/[0]*?[0]/", @$get_mail_body, $body_match,
> PREG_OFFSET_CAPTURE ) ;
>
>   while ( $message = fgets ( $get_mail_body ) )
>     {
>         if ( $message == $body_match[0] )
>                 {
>                         $command = exec ( 'echo -e "\rLT
> 4>'.$body_match[0].'r\r" > /dev/ttyS1' ) ;
>                 }
>         else
>                 {
>                 }
>     }
>   echo "$command" ;
>
>   fclose( $get_mail_body );
> ?>
>
> ######################################################################################################
>
> And here is my procmail recipe:
>
> ######################################################################################################
> :0
> * ^Subject.*Aprs message$
> {
> :0 bf
> ! `/usr/bin/php -f /usr/local/bin/scripts/aprs_messages.php`
> }
>
> ######################################################################################################
>
> Any pointers?
>
> Thank You
>
> Danny
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux