title: How to parse href value and its name from <span class=?
body: <p>Here in my html <code>string($str)</code> contains links and their titles/names inside span.I want to extract <code>view.php?id=123,view.php?id=124</code> and their names galaxy and galaxy2. </p>
  
  <p>Can any one help me extract the link and its name inside span ?I tried following but i get no data!Thanks in advance.</p>
  
  <pre><code>$str="...............&lt;span class="title" &gt;&lt;a href="view.php?id=123" class="title"&gt;&lt;strong&gt;galaxy&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;............&lt;span class="title" style=background:#000000&gt;&lt;a href="watch.php?id=124" class="title"&gt;&lt;strong&gt;galaxy2&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;";
  
  if(preg_match_all('/\&lt;span class="title" &gt;&lt;a href=(.*?)\&lt;\/strong&gt;/',$str,$match)) 
  {             
      echo "&lt;br&gt;href:".$match[1][0];
      echo "&lt;br&gt;";
      echo "title:"
  }
  </code></pre>
  
  <p>str sample data:</p>
  
  <pre><code>&lt;div class="profile cleaning" id="contentlist"&gt;
  &lt;div class="profile-item "&gt;
  &lt;div class="img" data-preview="view.php?id=123"&gt;
  &lt;img src="./logos/123.jpg" width="240" height="140" alt=""&gt;
  &lt;/div&gt;
  &lt;span class="title" style=background:#000000&gt;&lt;a href="view.php?id=123" class="title"&gt;&lt;strong&gt;Galaxy 1&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;div class="profile-item "&gt;
  &lt;div class="img" data-preview="view.php?id=124"&gt;
  &lt;img src="./logos/124.jpg" width="240" height="140" alt=""&gt;
  &lt;/div&gt;
  &lt;span class="title" style=background:#000000&gt;&lt;a href="view.php?id=124" class="title"&gt;&lt;strong&gt;Galaxy 2&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;div class="profile-item "&gt;
  &lt;div class="img" data-preview="view.php?id=125"&gt;
  &lt;img src="./logos/125.png" width="240" height="140" alt=""&gt;
  &lt;/div&gt;
  &lt;span class="title" style=background:#000000&gt;&lt;a href="view.php?id=125" class="title"&gt;&lt;strong&gt;Galaxy 3&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;div class="profile-item " style="background:#000000;border:1px solid #326EE0;"&gt;
  &lt;div class="img" data-preview="view.php?id=126"&gt;
  
  &lt;div style="position: relative; left: 0; top: 0;vertical-align:top"&gt;
  &lt;img src="./logos/126.png" style="border: none;padding:1px;border:2px solid #326EE0;margin:0px;margin-bottom:2px;width:240px;position: relative; top: 0; left: 0; " &gt;
  &lt;img src="images/mango.png" style="width:240px;position: absolute; top: 0px; left: 0px;"/&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;span class="title" &gt;&lt;a href="view.php?id=126" class="title"&gt;&lt;strong&gt;Galaxy 4&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;div class="profile-item " style="background:#000000;border:1px solid #326EE0;"&gt;
  &lt;div class="img" data-preview="view.php?id=127"&gt;
  
  &lt;div style="position: relative; left: 0; top: 0;vertical-align:top"&gt;
  &lt;img src="./logos/127.jpg" style="border: none;padding:1px;border:2px solid #326EE0;margin:0px;margin-bottom:2px;width:240px;position: relative; top: 0; left: 0; " &gt;
  &lt;img src="images/mango.png" style="width:240px;position: absolute; top: 0px; left: 0px;"/&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;span class="title" &gt;&lt;a href="view.php?id=127" class="title"&gt;&lt;strong&gt;Galaxy 5&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;div class="profile-item " style="background:#000000;border:1px solid #326EE0;"&gt;
  &lt;div class="img" data-preview="view.php?id=128"&gt;
  
  &lt;div style="position: relative; left: 0; top: 0;vertical-align:top"&gt;
  &lt;img src="./logos/128.jpg" style="border: none;padding:1px;border:2px solid #326EE0;margin:0px;margin-bottom:2px;width:240px;position: relative; top: 0; left: 0; " &gt;
  &lt;img src="images/mango.png" style="width:240px;position: absolute; top: 0px; left: 0px;"/&gt;
  &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;span class="title" &gt;&lt;a href="view.php?id=128" class="title"&gt;&lt;strong&gt;Galaxy 6&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;
  &lt;/div&gt;&lt;/div&gt;
  </code></pre>