0

I want to find a particular matches of strings (want to find middle string by giving parameters start and end string ) from an HTML file i used the following code

 $string = " ".$ipt;
 $ini = strpos($string,$start);
 if ($ini == 0) return "";
 $ini += strlen($start);
 $len = strpos($string,$end,$ini) - $ini;
 return substr($string,$ini,$len);

it can find the middle sting but it can only return 1 match from HTML file i want all possible matches PLEASE HELP ME

starting string is - <div class="product"> end is - <br class="no">

dev-null-dweller
  • 29,274
  • 3
  • 65
  • 85
Rahul
  • 23
  • 2
  • *(related)* [Best Methods to parse HTML](http://stackoverflow.com/questions/3577641/best-methods-to-parse-html) – Gordon Oct 28 '12 at 14:30

1 Answers1

1

If you want to use the same methods you used in the code above, take a look at this: http://il1.php.net/manual/en/function.strpos.php#108426

Other than that, there is preg_match: http://il1.php.net/manual/en/function.preg-match.php

Ynhockey
  • 3,845
  • 5
  • 33
  • 51