Welcome to WebmasterWorld Guest from 54.162.12.134

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

News Harvesting with PHP?

Can I use a PHP script to do the same job as a PERL script?

     
9:57 am on Mar 19, 2001 (gmt 0)

10+ Year Member



The Guardian Online [guardian.co.uk...] allow anyone to harvest their news content using a PERL script. Unfortunately our servers don't have PERL support, neither are they likely to - I'm at the mercy of our IT dept.

Do you think I could install a PHP script to do the same job? Or should I just kick my IT departments ass?

10:37 am on Mar 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, you can do this with PHP :-)

Assuming that the content you want is at [somedomain.com...] , just put the following snippet at an appropriate point in your page to include the remote content:

<?
$harvest=file("http://www.somedomain.com/foo.html");
for($i=0; $i< count($harvest) ; $i++) {
echo($harvest[$i]);
}
?>

This will harvest on every visit to the page - you may want to think about caching locally, but if it's just a news feed then the above should work fine as it is.

10:54 am on Mar 19, 2001 (gmt 0)

10+ Year Member



sugarkane - you truly are a star!

I'll give this a try and I'll let you know how I get on.

Many thanks.

11:11 am on Mar 19, 2001 (gmt 0)

10+ Year Member



Well blow me!! It jolly well works!!

Brill - three lines of PHP that does exactly the same job as about 30 of PERL.

Cheers.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month