title: DOM & XPath scraping - Bringing back both li elements text, when only want the one
body: <p>Here is my code so far.</p>
  
  <pre><code>$dom_currys = new DOMDocument;
  libxml_use_internal_errors(TRUE);
  $dom_currys-&gt;loadHTMLFile('http://www.currys.co.uk/gbuk/apple-new-ipod-touch-8gb-4th-generation-07677427-pdt.html');
  libxml_clear_errors();
  
  $xpath_currys = new DOMXpath($dom_currys);
  $nodes_currys = $xpath_currys-&gt;query(
      '/html/body/div/div/div[2]/div/div/div[2]/div/ul[2]/li/span'
  );
  $currys_stock_data = $nodes_currys-&gt;item(0)-&gt;nodeValue; // "Available for home delivery"
  
  echo $currys_stock_data;
  </code></pre>
  
  <p>When echoed, it comes back with </p>
  
  <pre><code>Â Available for home delivery
  Â Available to reserve &amp; collect 
  </code></pre>
  
  <p>I only require the "Available for home delivery" part. Each is in a separate "li" element, however still it brings back both, the XPath if I wanted the second one would be</p>
  
  <pre><code>/html/body/div/div/div[2]/div/div/div[2]/div/ul[2]/li[2]/span
  </code></pre>
  
  <p>I suspect its to do with selecting the correct item, but not sure if its right or not. </p>
  
  <p>Also I require that the result be checked by an IF statement. What I have so far:</p>
  
  <pre><code>if (strpos($currys_stock_data, 'Available for home') !== false) {
      $currys_stockyesno = "Yes";
  } else {
      $currys_stockyesno = "No";
  }
  echo $currys_stockyesno;
  </code></pre>
  
  <p>I thought it would be best to check if it contained "Available for home delivery" rather than a straight match, because the website can sometimes say its available for home delivery in 2 days, along those lines. So long as the string contained that string, then it would return as true/yes. But it's saying no...</p>