Hi all, I have this URL that display date and news title. All i need is grab only news title and direct it on my another site. So far, i have done stripped the date and title but have no idea how to grab only the one i need. Just a few steps away i can be done my job, does anyone here can helping me out? Many thanks
This is the URL php file:
//Some php and html code here..
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<?php foreach($news as $data){ ?>
<tr class="black_navi_link">
<!-- Date display -->
<td width="75"><?php echo substr($data['Date'],8,2).$news_title['day'][$lang].substr($data['Date'],5,2).$news_title['month'][$lang]; ?></td>
<!-- Title display -->
<td width="2"></td>
<td><a href="javascript:news();" onClick="javascript:ShowNews('<?php echo $data['ID']; ?>');">
<?php if(strlen($data['Title'])>48){ echo substr($data['Title'],0,48).'...'; }else{ echo $data['Title']; } ?></a></td>
</tr>
<?php } ?>
//Some php and html code here...
This is stripped.php
$file = fopen(http://www.news_abc.com, "r");
$news_to_load = 3;
$max_loop = 5;
$loop_times = $max_loop;
$content = "<table width='100%' cellpadding='0' cellspacing='1' border='0'>";
while ( !feof($file) && $news_to_load > 0 ){
$str = fgets($file);
if ( stristr($str, "<tr class=\"black_navi_link\">") ){
$news_to_load = $news_to_load - 1;
$content = $content . $str;
while ( $loop_times > 0 ){
$str = fgets($file);
$str = str_replace("<a href=\"javascript:news();\" onClick=\"javascript:ShowNews('", "<anchor><go href='news.php?nid=", $str);
$str = str_replace("');\"", "'", $str);
$str = str_replace("</a>", "</go></anchor>", $str);
$content = $content . $str;
$loop_times = $loop_times - 1;
}
$loop_times = $max_loop;
}
}
$content = $content . "</table>";
echo $content;