title: Find multiple string positions in PHP
body: <p>I`m writing a PHP page that parses given URL. What I can do is find the first occurrence only, yet when I echo it, I get another value rather than the given.</p>
  
  <p>this is what I did till now.</p>
  
  <pre><code>&lt;?php
  $URL = @"my URL goes here";//get from database
  $str = file_get_contents($URL);
  $toFind = "string to find";
  $pos = strpos(htmlspecialchars($str),$toFind);
  echo substr($str,$pos,strlen($toFind)) . "&lt;br /&gt;";
  $offset = $offset + strlen($toFind);
  ?&gt;
  </code></pre>
  
  <p>I know that a loop can be used, yet I don`t know the condition neither the body of the loop would be.</p>
  
  <p>And how can I show the output I need??</p>