Scrape?

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 &...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 11-12-2007
tedd
 
Posts: n/a
Default Re: [PHP] Scrape? (Fetch email)

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
Reply With Quote
  #12 (permalink)  
Old 11-12-2007
Jake
 
Posts: n/a
Default Re: [PHP] Scrape? (Fetch email)



> 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);
}
Reply With Quote
  #13 (permalink)  
Old 11-12-2007
Colin Guthrie
 
Posts: n/a
Default Re: Scrape? (Fetch email)

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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:27 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0