hisham
IS-IT--Management
- Nov 6, 2000
- 194
I have an html file:
------------------------------------------
<h1>title<br>
title_one</h1>
<h3>ONE<br>
TOW<br>
THREE<br>
FOUR<br>
FIVE<br>
SIX</h3>
</body>
-------------------------------------------
I used the following code to get a text like "ONE TOW THREE FOUR FIVE SIX"
-------------------------------------------
function cleanUpHTML($text) {
$body_tags = array ("\r","\n",<h1>,<h3>,</h1>,</h3>","<br>");
$rmv_tags = array ("","","","","","","\n");
$text = str_replace ($body_tags,$rmv_tags,$text);
return ($text);
$fname = "path_to_my_file";
$whole_file = file_get_contents ($fname);
$text_pos = strpos($whole_file, '</h1>') + 5;
$text_finish = strpos($whole_file, '</body>');
$text = cleanUpHTML(substr($whole_file, $text_pos, ($text_finish - $text_pos)));
echo $text;
-------------------------------------------
but in this way I can't get the word ONE to insert it in a database.
how can I get every word into a string?
Thanks in advance.
------------------------------------------
<h1>title<br>
title_one</h1>
<h3>ONE<br>
TOW<br>
THREE<br>
FOUR<br>
FIVE<br>
SIX</h3>
</body>
-------------------------------------------
I used the following code to get a text like "ONE TOW THREE FOUR FIVE SIX"
-------------------------------------------
function cleanUpHTML($text) {
$body_tags = array ("\r","\n",<h1>,<h3>,</h1>,</h3>","<br>");
$rmv_tags = array ("","","","","","","\n");
$text = str_replace ($body_tags,$rmv_tags,$text);
return ($text);
$fname = "path_to_my_file";
$whole_file = file_get_contents ($fname);
$text_pos = strpos($whole_file, '</h1>') + 5;
$text_finish = strpos($whole_file, '</body>');
$text = cleanUpHTML(substr($whole_file, $text_pos, ($text_finish - $text_pos)));
echo $text;
-------------------------------------------
but in this way I can't get the word ONE to insert it in a database.
how can I get every word into a string?
Thanks in advance.