homepage Welcome to WebmasterWorld Guest from 54.81.170.186
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
News Harvesting with PHP?
Can I use a PHP script to do the same job as a PERL script?
rycrostud




msg:1312570
 9:57 am on Mar 19, 2001 (gmt 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?

 

sugarkane




msg:1312571
 10:37 am on Mar 19, 2001 (gmt 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.

rycrostud




msg:1312572
 10:54 am on Mar 19, 2001 (gmt 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.

rycrostud




msg:1312573
 11:11 am on Mar 19, 2001 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved