ok, my english is bad, and i am confusing. i will try to explain it more simple.
i need php script which will open html file located on same server ...fopen("test.html") ..
then i need to read line by line and if php script find in html file, for example
<a href="http://google.com">GOOGLE</a>, i want to print that in next format:
LINK: google(http://google.com)
so, script need to recognize it is link and print in format above.
i need same for <img> tag, <p>, <br>.... if script find BR in text it will show BREAK LINE
i did that for A HREF
if(preg_match('/<a href=\"(.*?)\">.*?<\/a>/i', $buff2))
{
$buff2 = preg_replace('/<a href=\"(.*?)\">(.*?)<\/a>/i', "\n".'LINK: $1 ($2)', $buff2);
}
but, i tried to do for <img> and it doesn't work .
elseif(preg_match('/<img src=\"(.*?)\" alt=\"(.*?)\"\/>/i', $buff2))
{
$buff2 = preg_replace('/<img src=\"(.*?)\" alt=\"(.*?)\"\/>/i', "\n".'IMAGE: $1', $buff2);
}
also, when there is only text, which is not located between some tags, it need to be recognized as TEXT: part of text(10 characters for example).
$buff2 = preg_replace("/(.+)\n/i", 'TEXT: $1' . "\n", $buff2);
problem is that, when there is empty line in html file, php script show it as TEXT: and there is nothing....
maybe now it's easier to understand.