php - Extract text between 2 strings? -


this question has answer here:

i have huge html page contains multiple data this

<td style="font-size:24px;" bgcolor="#f0f0f0" width="60%">     <strong>id:full name:email@email.com:mobile:country</strong> </td> 

i want extract data between tags id:full name:email@email.com:mobile:country

so regex or custom php function?

ps: above code being repeated multiple times in page , want data stored in array.

as of others has said, can use domdocument , domxpath. this:

$html = '<td style="font-size:24px;" bgcolor="#f0f0f0" width="60%"> <strong>id:full name:email@email.com:mobile:country</strong></td>'; $dom = new domdocument(); $dom->loadhtml($html); $xpath = new domxpath($dom); $text = $xpath->query('//td/strong')->item(0)->nodevalue; echo $text; // id:full name:email@email.com:mobile:country 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -