i need some help with logic here. i am reading contents with ob_get_contents. then i need to search for and fetch the contents and id's in a custom tag. eg: <translate id="4" token_id="0" variant_id="1">contents............</translate>.
i wanted to do that with preg_match_all but it get complicated trying to fetch the id's. does anyone have a better idea how best to go about it?
cali_dotcom
0
Junior Poster in Training
Recommended Answers
Jump to PostIf it is XML output I would parse it using the xml parsing functions.
However, if it's not entirely XML (or not XML at all), then using preg_match_all should be fine. Here's some sample code to show you:
$b = <<<'ENDOFEXAMPLE' <translate id="4" token_id="0" variant_id="1">contents............</translate> blah …
All 3 Replies
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
edwinhermann
57
Junior Poster
cali_dotcom
0
Junior Poster in Training
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.