473,785 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rss to email script?

Hi,

is there a script out there that can send RSS feeds to a given email
account? I have search the usual suspects (google, SF, FM, hotscripts) but
could not find anything

thanks

Oliver

Jul 17 '05 #1
4 7904
NC
Oliver Spiesshofer wrote:

is there a script out there that can send RSS feeds to a given email
account?


It's a two-line affair, really:

$rss_feed = file_get_conten ts('http://example1.com/feed.rss');
mail('u***@exam ple2.com', 'RSS Feed from Example1.com', $rss_feed,
'Content-Type: application/rss+xml');

Cheers,
NC

Jul 17 '05 #2
"NC" <nc@iname.com > wrote in news:1109098736 .662898.47610
@c13g2000cwb.go oglegroups.com:
Oliver Spiesshofer wrote:

is there a script out there that can send RSS feeds to a given email
account?


It's a two-line affair, really:

$rss_feed = file_get_conten ts('http://example1.com/feed.rss');
mail('u***@exam ple2.com', 'RSS Feed from Example1.com', $rss_feed,
'Content-Type: application/rss+xml');


yes but not exactly what I want.
I want each item of the rss sent as a seperate email with the proper $from
$subject etc fields filled in so I can mark single items as read. Also, it
should not send anything twice, and check for new items in the rss feed at
a given interval.

Oliver

Jul 17 '05 #3
NC
Oliver Spiesshofer wrote:
is there a script out there that can send RSS feeds to
a given email account?


It's a two-line affair, really:

$rss_feed = file_get_conten ts('http://example1.com/feed.rss');
mail('u***@exam ple2.com', 'RSS Feed from Example1.com', $rss_feed,
'Content-Type: application/rss+xml');


yes but not exactly what I want.
I want each item of the rss sent as a seperate email with
the proper $from $subject etc fields filled in so I can mark
single items as read. Also, it should not send anything twice,
and check for new items in the rss feed at a given interval.


Ah, now we are talking specifications. .. First of all, "check
for new items in the rss feed at a given interval" cannot be
implemented in PHP; you'll have to use OS-level scheduling
facilities for that.

Given your preference for itemization, I don't think you'll be
able to find anything that will fit you out of the box. This,
however, should get you started:

$content = file_get_conten ts('http://example1.com/feed.rss');
$p = xml_parser_crea te();
xml_parse_into_ struct($p, $content, $vals, $index);
xml_parser_free ($p);
unset($content) ;
foreach ($index['LINK'] as $key => $link_id) {
$title_id = $index['TITLE'][$key];
$description_id = $index['DESCRIPTION'][$key];
$title = $vals[$title_id]['value'];
$link = $vals[$link_id]['value'];
$description = $vals[$description_id]['value'];
$subject = 'Example1.com: ' . $title;
$message = $title . "\r\n" . $link . "\r\n\r\n" .
wordwrap($descr iption, 72, "\r\n");
mail('u***@exam ple2.com', $subject, $message);
}

The only functionality missing from your request is "it should
not send anything twice". You can implement it by creating
a log file or a database where you will store URLs of pages
whose descriptions have already been sent. Let's say you
implemented these two functions:

boolean link_logged(str ing $link)
Returns true if $link is already in the database or false
otherwise.

void log_link(string $link)
Adds a new record to the log.

Then your code can morph into something like this:

$content = file_get_conten ts('http://example1.com/feed.rss');
$p = xml_parser_crea te();
xml_parse_into_ struct($p, $content, $vals, $index);
xml_parser_free ($p);
unset($content) ;
foreach ($index['LINK'] as $key => $link_id) {
$title_id = $index['TITLE'][$key];
$description_id = $index['DESCRIPTION'][$key];
$title = $vals[$title_id]['value'];
$link = $vals[$link_id]['value'];
$description = $vals[$description_id]['value'];
if (!link_logged($ link)) {
$subject = 'Example1.com: ' . $title;
$message = $title . "\r\n" . $link . "\r\n\r\n" .
wordwrap($descr iption, 72, "\r\n");
mail('u***@exam ple2.com', $subject, $message);
log_link($link) ;
}
}

Proper "From:" heading is still missing, but it wouldn't be
too hard to add...

Cheers,
NC

Jul 17 '05 #4
thanks a lot for your help.
Finally I took a RSS parser (DOMIT) and made a database, cronjob etc.

You can take a look at it at

http://tokyoahead.com/main/staticpag...age=newsmailer

You have t oregister on the site however in order to verify the email
address...

Oliver

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2124
by: krystoffff | last post by:
Hi all ! I've got a very weird problem ! I was trying to make my PHP script to send emails to every subscribed member to go faster (each email takes 1 or 2 seconds to be sent !) so I tried to send my emails directly with Sendmail instead of the function mail(), with the option "-odb" (delivery in background). With this option, the script was really faster, but I noticed that all the emails were not delivered !
12
8801
by: Chuck Anderson | last post by:
Can anyone point me in the right direction? I want to use Php to automate confirmation of someone joining an email list by them replying to an email (so they don't have to have a browser?). I will probably use a hyperlink with a unique ID, but I also want to know how to go about reading from a mailbox with Php so I can use an email reply method, too. I'm having trouble finding any kind of tutorial. From the bit of searching I've done,...
9
2323
by: mcp6453 | last post by:
I'm posting in desperation and hopes that someone has a script that will achieve these objectives: 1. Web interface using forms collects Name, Address, Email Address. 2. Web interface sends this info to a PHP script. 3. PHP script has pre-entered text. 4. Name, Address, and Email Address are appended to the END of the outgoing email message. 5. The outgoing email address shows the "From" as the Email Address. 6. THE PROBLEM: The PHP...
4
2094
by: Bill | last post by:
Is it possible to somehow activate a page containing a php script by sending an email to a mailbox on the server? I have a script that sends out notification emails to an individual. He wants to receive them continuously until he decides he has seen enough of them. Then to stop receiving the emails he has to use his browser and go to the web page that is sending him the emails where he clicks a button. Would it be possible to arrange...
0
4524
by: John Silver | last post by:
I have a perl script running on machine A, a web server. A visitor completes certain pieces of data and these are compiled into two emails, one addressed to the visitor and copied to the site owner, the other addressed to the webmaster and including cookie and timing data for debugging. The email is sent by machine B which is the email server for the domain. Here are some config values for the perl script, names have been changed to...
4
5190
by: web_design | last post by:
I put this together from some other scripts I am using on a site. I'm trying to make a better email hiding script. It isn't working. Also, it causes Internet Explorer 6 SP2 to block the script as "active content". :( The idea is that if the user doesn't have JavaScript enabled, they will see an image of the email address (that can't be read by email harvesting programs). If JavaScript is enabled, the image will be hidden and the...
2
1842
by: E.T. Grey | last post by:
Is it possible to have a PHP script receive an email (CSV text). The problem is this, I want a server to send me an email, and then I want to be able to have a PHP script 'listening' for email and then processing the data in the email. Is it possible to have a PHP script 'listening' or responding to an 'email received' event, so that it can process the data ? TIA
4
2228
by: ianbarton | last post by:
Hello all I am trying to setup a feedback form on my webpage using some script provided by my ISP. I really don't know a lot about PHP and it's syntax etc. The feedback form only has 4 fields. These are UserName, UserEmail, UserCountry & Comments. It works well with all of those fields appearing in the body of an email that is sent to me. What I would now like is for the UserEmail field to appear in the "From:" field in the
9
2208
by: Jerim79 | last post by:
I am no PHP programmer. At my current job I made it known that I was no PHP programmer during the interview. Still they have given me a script to write with the understanding that it will take me a while (This information is just for general knowledge as I don't want anyone thinking I am trying to be dishonest with my intentions. Also, I do not portray myself as something I am not. I am a beginner.) Anyway, what the script needs to do is...
6
1940
by: cfish | last post by:
I'm trying to script my contact page and I have everything the way I want it however I cannot get my script to output Address, City, State, Zip & Phone Number when I get a email. It will output email address, subject & message. Please help! /* BELLonline PHP MAILER SCRIPT v1.4 Copyright 2006 Gavin Bell http://www.bellonline.co.uk gavin@bellonline.co.uk modified by Craig Fisher for Dakota Portraits - 1-30-2006 */
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.