This is a discussion on Scrape? within the PHP General forums, part of the PHP Programming Forums category; At 12:53 PM -0500 11/12/07, Daniel Brown wrote: >On Nov 12, 2007 12:46 PM, tedd &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
At 12:53 PM -0500 11/12/07, Daniel Brown wrote:
>On Nov 12, 2007 12:46 PM, tedd <tedd.sperling@gmail.com> wrote: >> > I haven't used GA (probably the only web guy left in the world), >> >but if it has an email feature like Stut mentioned, Tedd, you could >> >run it through a piped-to-PHP email-parsing script. >> >> That's the idea. >> >> I can send the email from Google to a specific email address. >> >> Now, how can I get php to fetch the email? >> >> Cheers, >> >> tedd > > -- > > It doesn't have to fetch the email. > >/etc/localalises (or equivalent) Add: >google-analytics: |/path/to/script.php > > Then just have mail from that sent to google-analytics@yourdomain.com. Hmmmm interesting. Do you mean that I can have an email sent directly to a script? If so, what triggers the script? How does the script capture the email to parse? Do you have an example or reference? Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|||
|
> At 12:53 PM -0500 11/12/07, Daniel Brown wrote: >>On Nov 12, 2007 12:46 PM, tedd <tedd.sperling@gmail.com> wrote: >>> > I haven't used GA (probably the only web guy left in the world), >>> >but if it has an email feature like Stut mentioned, Tedd, you could >>> >run it through a piped-to-PHP email-parsing script. >>> >>> That's the idea. >>> >>> I can send the email from Google to a specific email address. >>> >>> Now, how can I get php to fetch the email? >>> >>> Cheers, >>> >>> tedd >> > -- >> >> It doesn't have to fetch the email. >> >>/etc/localalises (or equivalent) Add: >>google-analytics: |/path/to/script.php >> >> Then just have mail from that sent to >> google-analytics@yourdomain.com. > > Hmmmm interesting. Do you mean that I can have an email sent directly to a > script? > > If so, what triggers the script? > > How does the script capture the email to parse? Do you have an example or > reference? > > Cheers, > > tedd > > I made one using procmail instead of aliases, but same idea... here is a snippet Jake $buffer = ''; $fp = fopen("php://stdin", "r"); if ($fp) { while(!feof($fp)) { $buffer .= fgets($fp, 4096); } fclose($fp); } |
|
|||
|
Jake wrote:
> $buffer = ''; > $fp = fopen("php://stdin", "r"); > if ($fp) > { > while(!feof($fp)) > { > $buffer .= fgets($fp, 4096); > } > fclose($fp); > } > That will get you the data (I think file_get_contents('php://stdin') will also work). Interpreting the mail is a little harder but I think there is a pecl extension for it... yup: http://pecl.php.net/package/mailparse HTHs Col |