<?php $html = '<!DOCTYPE html> <html> <head></head> <body> <h1>Some Text</h1> <p>This is the first Paragraph</p> <ul> <li></li> <li></l1> </ul> <p>This is the second Pharagraph</p> </body> </html>'; $err = libxml_use_internal_errors(true); $dom = new DOMDocument(); $dom->loadHTML($html); libxml_clear_errors(); libxml_use_internal_errors($err); // find all p tags, select the first, get its value $pValue = $dom->getElementsByTagName('p')->item(0)->nodeValue; //This is the first Paragraph echo $pValue;
You have javascript disabled. You will not be able to edit any code.