2

A webiste www.example.com have many lists in it. That is,

   <ol>
    <li>This is a list saying about asp</li>
    <li>This is a list  saying about javascript</li>
    <li>This is a list saying about php</li>
    <li>This is a list saying about .net</li>
    </ol>

I need to Get the list with a word "php" using php.
That is the output should be "This is a list saying about php"

How can i do this with preg_match???

I used CURL class to fetch the HTML contents. here is the code i used

$site = $curl->get("http://www.example.com/outputs.html");
$pattern = 'I NEED TO GET THIS PATTERN';
preg_match($pattern, $site, $matches);
$php_out = $matches[1];
echo $php_out;

when i use,

$pattern = '/<li>(.*?)<\/li>/s';

It returns the first result
That is "This is a list saying about asp"

Abhijith P
  • 33
  • 5
  • possible duplicate of [How to parse and process HTML with PHP?](http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php) – John Conde Aug 23 '12 at 12:57
  • Do you have to fetch the HTML from the page and search for the word or do you already have the HTML in your script? – futuregeek Aug 23 '12 at 12:59