You are here: Re: Pulling date-specific data from flat file « PHP Programming Language « IT news, forums, messages
Re: Pulling date-specific data from flat file

Posted by Randy Harmelink on 11/01/06 07:56

I have a PHP routine that does an RSS website scraping process only
once per day - I use an external file to trigger whether it does
anything or not. Here's what I use:

$inData = file_get_contents('/xml/ts/data1.txt');
$str = file_put_contents('/xml/ts/data1.txt', $pubDate);
if ($inData != $pubDate) { ...do this process ... }

The first statement retrieves a publication date that was last saved.
The second statement writes the new publication date to the file.
Then, I only do my daily process if the publication date I retrieved is
different from the one I just wrote. Technically, I probably should
only write the new date AFTER my process is complete -- just in case a
problem occurs and the process doesn't complete.

But, anyway, those two functions are a nice easy way to read and write
a flat file.

On Nov 1, 12:41 am, "danielbaars" <danielba...@gmail.com> wrote:
>
> I'm almost a complete newbie to using PHP and I was hoping one of you
> guys can point me in the right direction. I'm working on a site for a
> brand of handmade fruit juice and it only needs one bit of dynamic
> content: the info on what fruit is in the juice and where it is coming
> from (vendor, country etc.) today and tomorrow (the content of the
> juice is different everyday). So I thought it would be easiest to put
> that information in a flat file (an Excel file would be ideal but a
> plain text would do too) on a weekly basis and try to pull out the
> needed info with PHP. Except I don't know how yet. I don't expect any
> of you to do the work for me but if someone could point me to which
> functions of PHP I should do some research on, I'd be most grateful.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация