i need to identify news header & body of following text file.


text:

<clip ~ Recommendation of Dividend of ICB >
Investment Corporation of Bangladesh has recommended 100% Stock Dividend (i.e. 1 Bonus share against 1 ordinary share) & 5% Cash Dividend for the year 2008-2009. EGM & AGM will be held on 21 Nov '09 at 11:00 & 11:30 am respectively(cont)
</clip>
<clip ~ CB free of KECOS, KDGNT & ICB >
Please note that there will be no price limit on the trading of the shares of Keya Cosmetics Ltd., Keya Detergent Ltd. & Investment Corporation of Bangladesh today 13 Oct '09 following their corporate disclosure.
</clip>
<clip ~ cont-Recommendation of Dividend of ICB >
at Jatiya Krira Porishad Bhaban(NSC Tower) 62/3, Purana Paltan, Dhaka. Record Date for EGM & AGM is on 4 Nov '09.(end)
</clip>
<clip ~ Message from CSE >
All investors are requested to make their investment decision on the basis of financial strength of the companies not on the basis of rumor.
</clip>
<clip ~ Sponsoring a Mutual Fund by JMBNK >
Jamuna Bank Ltd. has informed that the Board of Directors of the Bank has decided to sponsor a close-end Mutual Fund namely Jamuna Bank First ICB AMCL Mutual Fund of Tk. 200 crore of the duration of 10 years with the following features: (cont)
</clip>
<clip ~ cont1-Sponsoring a Mutual Fund by JMBNK >
1. Size of the Fund: Tk. 2000 million dividend into 200 million units of Tk. 10 each at par. 2. Market Lot: The face value of each unit of the Fund will be Tk. 10 (ten) and the market lot will consist of 500 (five hundred) units.(cont)
</clip>
<clip ~ cont2-Sponsoring a Mutual Fund by JMBNK >
3. Proposed Distribution of Fund: Sponsor-Jamuna Bank Ltd: 20%, Pre-IPO Private Placement: 20% & Public Offer: 60%. The Board of Directors has also decided to appoint ICB Asset Management Co. Ltd. as Asset Manager and (cont)
</clip>
<clip ~ cont3-Sponsoring a Mutual Fund by JMBNK >
Investment Corporation of Bangladesh as Trustee as well as Custodian of the proposed Mutual Fund subject to approval of SEC.(end)
</clip>
<clip ~ Intention to buy MTBNK Shs >
Ms. Mansura Rahmatullah, one of the Sponsors of Mutual Trust Bank Ltd. has reported her intention to buy 3,250 shs in addition to her holdings of 1,91,070 shs of the bank at prevailing market price through Stock Exchange within next 30 working days.
</clip>

try using

ob_start(); // start buffer
include ("file-to-include.php");
$content = ob_get_contents(); // assign buffer contents to variable
ob_end_clean(); // end buffer and remove buffer contents
echo $content;

or

<?php 
$handle = @fopen('yourfile...', "r"); 
if ($handle) { 
   while (!feof($handle)) { 
       $lines[] = fgets($handle, 4096); 
   } 
   fclose($handle); 
} 
?>

this will give you the contents of the file in an array. Then test the contents of the array for your <clip></clip> tags. Fill an array with the text you need then empty each part of the string array the way you need it to appear.

For ( $x=0;$x=count($lines[]);x++) // or $contents[]
{
If (strstr($lines[x], "<clip")) // test for opening tag
 {
 $headline = strstr($lines, "~") // output after ~
 $text = $lines[($x+1)]; // read next lines
 $x = $x + 2; // advance passed the tags and continue
 }
}

I have not tested the code so please understand there might be a few errors, but this should set you in the right direction.

i need to identify news header & body of following text file.


text:

<clip ~ Recommendation of Dividend of ICB >
Investment Corporation of Bangladesh has recommended 100% Stock Dividend (i.e. 1 Bonus share against 1 ordinary share) & 5% Cash Dividend for the year 2008-2009. EGM & AGM will be held on 21 Nov '09 at 11:00 & 11:30 am respectively(cont)
</clip>
<clip ~ CB free of KECOS, KDGNT & ICB >
Please note that there will be no price limit on the trading of the shares of Keya Cosmetics Ltd., Keya Detergent Ltd. & Investment Corporation of Bangladesh today 13 Oct '09 following their corporate disclosure.
</clip>
<clip ~ cont-Recommendation of Dividend of ICB >
at Jatiya Krira Porishad Bhaban(NSC Tower) 62/3, Purana Paltan, Dhaka. Record Date for EGM & AGM is on 4 Nov '09.(end)
</clip>
<clip ~ Message from CSE >
All investors are requested to make their investment decision on the basis of financial strength of the companies not on the basis of rumor.
</clip>
<clip ~ Sponsoring a Mutual Fund by JMBNK >
Jamuna Bank Ltd. has informed that the Board of Directors of the Bank has decided to sponsor a close-end Mutual Fund namely Jamuna Bank First ICB AMCL Mutual Fund of Tk. 200 crore of the duration of 10 years with the following features: (cont)
</clip>
<clip ~ cont1-Sponsoring a Mutual Fund by JMBNK >
1. Size of the Fund: Tk. 2000 million dividend into 200 million units of Tk. 10 each at par. 2. Market Lot: The face value of each unit of the Fund will be Tk. 10 (ten) and the market lot will consist of 500 (five hundred) units.(cont)
</clip>
<clip ~ cont2-Sponsoring a Mutual Fund by JMBNK >
3. Proposed Distribution of Fund: Sponsor-Jamuna Bank Ltd: 20%, Pre-IPO Private Placement: 20% & Public Offer: 60%. The Board of Directors has also decided to appoint ICB Asset Management Co. Ltd. as Asset Manager and (cont)
</clip>
<clip ~ cont3-Sponsoring a Mutual Fund by JMBNK >
Investment Corporation of Bangladesh as Trustee as well as Custodian of the proposed Mutual Fund subject to approval of SEC.(end)
</clip>
<clip ~ Intention to buy MTBNK Shs >
Ms. Mansura Rahmatullah, one of the Sponsors of Mutual Trust Bank Ltd. has reported her intention to buy 3,250 shs in addition to her holdings of 1,91,070 shs of the bank at prevailing market price through Stock Exchange within next 30 working days.
</clip>

error ocure

Fatal error: Cannot use [] for reading in F:\xampp\htdocs\cse2\std.php on line 24

remove the [] in the declare statments and remove them from any count statements. The only time that you need to use the [] is when you are accessing any specific part of the array. i.e. $array[1] or $list[x]
granted I stated that I did not debug the lines, just mearly gave you an idea to try. I hope this sets you on the right track. You will also need to expand your testing statements to read all of the text in your lines or the server will read each part as a line in the array. Meaning you might need to add a for loop to read all of the text that you need after your headline. This is only to tell if there is more that one line after the head line. Once this is complete you can output the information like you needed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.