Connecting Tech Pros Worldwide Forums | Help | Site Map

Need Guidance On this one

Realtime
Guest
 
Posts: n/a
#1: Dec 22 '05

How do I go about writing a php application that will alert people in a database
from different RSS news feeds from different sites. So lets say we have
a database and user A has a list of news alerts he wants to be alerted on.
So the application will go to a search engine that will bring up the results
in XML. The results are then stored in the database. I just need the logic
process. Because I am worried of the latency on the server. So how can
i process multiple alerts per user? Or even process multiple users at once.

Thanks..



Peter Fox
Guest
 
Posts: n/a
#2: Dec 22 '05

re: Need Guidance On this one


Following on from Realtime's message. . .[color=blue]
>
>How do I go about writing a php application that will alert people in a database
>from different RSS news feeds from different sites. So lets say we have
>a database and user A has a list of news alerts he wants to be alerted on.
>So the application will go to a search engine that will bring up the results
>in XML. The results are then stored in the database. I just need the logic
>process. Because I am worried of the latency on the server. So how can
>i process multiple alerts per user? Or even process multiple users at once.[/color]
Well done for realising you need guidance.

PHP is purely reactive. It bursts into life to process a HTTP request
then dies until the next request. It only sends HTTP responses to
whatever it was that sent the HTTP request.

A grim hack might be meta refresh. A better solution is something other
than PHP.





--
PETER FOX Not the same since the bookshop idea was shelved
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Realtime
Guest
 
Posts: n/a
#3: Dec 22 '05

re: Need Guidance On this one



Is there any ready made software to accomplish this ?

Hello Peter,
[color=blue]
> Following on from Realtime's message. . .
>[color=green]
>> How do I go about writing a php application that will alert people in
>> a database
>> from different RSS news feeds from different sites. So lets say we
>> have
>> a database and user A has a list of news alerts he wants to be
>> alerted on.
>> So the application will go to a search engine that will bring up the
>> results
>> in XML. The results are then stored in the database. I just need
>> the logic
>> process. Because I am worried of the latency on the server. So how
>> can
>> i process multiple alerts per user? Or even process multiple users at
>> once.[/color]
> Well done for realising you need guidance.
>
> PHP is purely reactive. It bursts into life to process a HTTP request
> then dies until the next request. It only sends HTTP responses to
> whatever it was that sent the HTTP request.
>
> A grim hack might be meta refresh. A better solution is something
> other than PHP.
>[/color]


NC
Guest
 
Posts: n/a
#4: Dec 22 '05

re: Need Guidance On this one


Realtime wrote:[color=blue]
>
> How do I go about writing a php application that will alert people in a database
> from different RSS news feeds from different sites. So lets say we have
> a database and user A has a list of news alerts he wants to be alerted on.
> So the application will go to a search engine that will bring up the results
> in XML. The results are then stored in the database. I just need the logic
> process. Because I am worried of the latency on the server. So how can
> i process multiple alerts per user? Or even process multiple users at once.[/color]

If you can schedule your script to run every hour or every day using
your operating system's scheduling facility, here's what you can do in
the script itself:

Query the database and obtain a list of all RSS feeds to which users
are sunscribed
For each RSS on the list {
Retrieve the feed
Parse the feed
For each item identified {
Check if it's in the database
If not, write it into the database and send an alert
to all users who subscribe to the feed
}
}

You might want to run this script using the command-line interpreter;
this will save system resources and help you get around the execution
time limit...

Cheers,
NC

Realtime
Guest
 
Posts: n/a
#5: Dec 23 '05

re: Need Guidance On this one



Thanks

Also is there a application out there that does scheduled database processing
with mySQL.

Hello NC,
[color=blue]
> Realtime wrote:
>[color=green]
>> How do I go about writing a php application that will alert people in
>> a database
>> from different RSS news feeds from different sites. So lets say we
>> have
>> a database and user A has a list of news alerts he wants to be
>> alerted on.
>> So the application will go to a search engine that will bring up the
>> results
>> in XML. The results are then stored in the database. I just need
>> the logic
>> process. Because I am worried of the latency on the server. So how
>> can
>> i process multiple alerts per user? Or even process multiple users at
>> once.[/color]
> If you can schedule your script to run every hour or every day using
> your operating system's scheduling facility, here's what you can do in
> the script itself:
>
> Query the database and obtain a list of all RSS feeds to which users
> are sunscribed
> For each RSS on the list {
> Retrieve the feed
> Parse the feed
> For each item identified {
> Check if it's in the database
> If not, write it into the database and send an alert
> to all users who subscribe to the feed
> }
> }
> You might want to run this script using the command-line interpreter;
> this will save system resources and help you get around the execution
> time limit...
>
> Cheers, NC
>[/color]


NC
Guest
 
Posts: n/a
#6: Dec 23 '05

re: Need Guidance On this one


Realtime wrote:[color=blue]
>
> Also is there a application out there that does scheduled database
> processing with mySQL.[/color]

To repeat, SCHEDULING IS NOT AN APPLICATION-LEVEL FEATURE, unless you
are willling to write a daemon/process (in which case PHP is probably
not the best tool for the job). Scheduling must be done on the
operating system level. Unix has cron, Windows, AT and Scheduler...

Cheers,
NC

Closed Thread