Jump to content
xisto Community
HannahI

Cpanel 11: Piping Issue

Recommended Posts

Hello,
I am using CPanel: 11 Accerated 2. I am trying to pipe email to a php script allowing me to run my site via email. I am getting a PHP related issue right now, but my issues with it have been changing. My error message is: <br />
<b>Parse error</b>: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in <b>/home/dbank/piped.php</b> on line <b>3</b><br />
My code follows:

#!/usr/bin/php -q<?php$fd = fopen("php://stdin","r");$email = "";while (!feof($fd)) {$email .= fread($fd, 1024);}fclose($fd);$lines = explode("\n", $email);$from = "";$subject = "";$headers = "";$message = "";$splittingheaders = true;for ($i=0; $i < count($lines); $i++) {if ($splittingheaders) {// this is a header$headers .= $lines[$i].\n;// look out for special headersif (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {$subject = $matches[1];}if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {$from = $matches[1];}} else {// not a header, but message$message .= $lines[$i].\n;}if (trim($lines[$i])=="") {// empty line, header section has ended$splittingheaders = false;}}mail("derekbank.bank9@gmail.com","Recieved",$message);?>
Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.