Welcome to WebmasterWorld Guest from 54.162.4.139

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)

Junior Member

10+ Year Member

joined:Feb 28, 2001
posts:73
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 6, 2000
posts:904
votes: 0


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)

Junior Member

10+ Year Member

joined:Feb 28, 2001
posts:73
votes: 0


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)

Junior Member

10+ Year Member

joined:Feb 28, 2001
posts:73
votes: 0


Well blow me!! It jolly well works!!

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

Cheers.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members