Current location: Hot Scripts Forums » Programming Languages » PHP » Editing this news grabing script


Editing this news grabing script

Reply
  #1 (permalink)  
Old 04-26-04, 10:21 AM
benj benj is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Editing this news grabing script

I have found this script that takes news from the bbc news website, the thing is its a nuke block and i want it to display on a page of its own (not using nuke at all) i was woundering to if it was possible for the news story to actually be displayed in my template instead of it opening the story on the bbc site?

any way heres the code

<?php



if( eregi( "block-News-BBC.php", $PHP_SELF ) )
{
Header( "Location: index.php" );
die( );
}

global $currentlang;

$file = fopen( "http://news.bbc.co.uk/1/low/world/default.stm", "r" );
$rf = fread( $file, 20000 );
$grab = eregi( "<h3>WORLD</h3>(.*)<b>AFRICA</b>", $rf, $printing );
$printing[ 1 ] = str_replace( "<div class=\"bodytext\">", "<TABLE WIDTH=\"100%\" CELLPADDING=\"0\" CELLSPACING=\"0\"><TR><TD VALIGN=\"TOP\" WIDTH=\"1\" ALIGN=\"LEFT\">&raquo;&nbsp;</TD><TD ALIGN=\"LEFT\" WIDTH=\"100%\">", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "</div>", "</TD></TR></TABLE>", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "<span class=\"h2\">", "", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "<a href=\"", "<A target=_blank HREF=\"http://news.bbc.co.uk", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "/low/", "/hi/", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "</span>", "", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "<br>", "", $printing[ 1 ] );
$printing[ 1 ] = str_replace( "<hr>", "", $printing[ 1 ] );

$pos = 0;
while ( !strpos( $printing[ 1 ], "</a>", $pos ) == false )
{
$pos = strpos($printing[ 1 ], "</a>", $pos ) + 4;
if (!strpos($printing[ 1 ], "<br clear=", $pos ) == false )
{
$pos1 = strpos($printing[ 1 ], "<br clear=", $pos ) - $pos + 16;
}
else
{
$pos1 = strpos($printing[ 1 ], "<!-- EOF -->", $pos ) - $pos;
}
$printing[ 1 ] = substr_replace( $printing[ 1 ], "", $pos, $pos1 );
}
fclose( $file );
$content = $printing[ 1 ]."<p align=\"center\"><a href=\"http://news.bbc.co.uk\" target=\"_blank\"><img border=\"0\" src=\"images/blocks/bbcnews.gif\"></a></p>";


?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 12:12 AM
Looking for news script SpaceGhost79 ASP 1 04-12-04 05:09 PM
Help with editing script zerutal JavaScript 3 04-05-04 02:06 AM
Starting Small - A simple news script RaiTid_R PHP 4 03-06-04 12:45 PM
a mysql news script darkcarnival General HotScripts Site Discussion 2 07-25-03 10:49 AM


All times are GMT -5. The time now is 10:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.