I am just starting with Simple PHP HTML DOM PARSER so, what is the way to replace text only of any fetched content. Suppose i have fetched some content from a website with full HTML codes, but while applying PHP code like
$html = str_replace(".", "DOT", $html); it cause a error. Because in this case it replace all
DOT so that all links are broken, but what i want is just to replace
DOT in texts but all code should be untouched.
Assuming, The fetched data is something like this
The Output should be like this
how to do like this? I'm a beginner so please describe more ... sorry for the damn question :)
Jump to Post
If you use a DOM parser, then you should loop through all nodes, replacing only the dot in the value texts.
All 6 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.