I'm new to PHP developemnt and a complete 'no-good' with regular expressions !!!!
I'm hitting my head on a wall trying to parse a html page.
Any help in this regard would be greatly welcomed.
I need to write a php script which will do this....
Parse any html page line by line.wherever it finds text, it will extract the text and store it in a different variable (array or something) and replace it with a unique token.
say if my html page is something like this
Code:$page_content = "<html> <title> My Page </title> <body> <div> Hello! </div> <div> Its a beautiful world </div> </body> </html>";
it should output to me two things
First the original html but texts replaced with tokens and the array of token=>strings map
Code:$new_page_content = "<html> <title> TOK_TITLE_1 </title> <body> <div> TOK_DIV_1 </div> <div> TOK_DIV_2 </div> </body> </html>"What could be the best way to do this.Code:$token_strings_array = array{ 'TOK_TITLE_1' => "My Page", 'TOK_DIV_1' => "Hello"!, 'TOK_DIV_2' => "Its a beautiful world" }
Is there any standard libraries/ classes ..that I could possible use??
Need help on this asap !!!






much to my frustration
Bookmarks