Re: Getting PHP to process input from STDIN
| From: | David OBrien | Date: | Sun, 24 Jan 2016 17:56:29 +0000 |
| Subject: | Re: Getting PHP to process input from STDIN | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325364@lists.php.net to get a copy of this message | ||
On Sun, Jan 24, 2016 at 12:40 PM, Danny <mynixmail@gmail.com> 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
>
>