title: php curl xml sitemap
body: <p>I want to get a file with php curl and get the URLs from inside the xml file</p>
  <p>I use the following code to do this and it works fine</p>
  <pre><code>&lt;?php
  $sUrl1= &quot;https://address.com&quot;;
  $aXmlLinks = array($sUrl1);
  $aOtherLinks = array();
  while (!empty($aXmlLinks)) {
      foreach ($aXmlLinks as $i =&gt;$sTmpUrl){
          unset($aXmlLinks[$i]);
          $aTmp = getlinkfromxmlsitemap($sTmpUrl);        
          array_push($aOtherLinks,$aTmp);        
      }
      
  }
  print_r($aOtherLinks);
  
  function getlinkfromxmlsitemap($sUrl) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch,CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0&quot;);
      curl_setopt($ch, CURLOPT_URL, $sUrl);
      $data = curl_exec($ch);
      $error= curl_error($ch);
      curl_close($ch);
      $links = array();
      $count = preg_match_all('@&lt;loc&gt;(.+?)&lt;\/loc&gt;@', $data, $matches);
      for ($i = 0; $i &lt; $count; ++$i) {
          $links[] = $matches[0][$i];
      }
      return $links;  
  }
  </code></pre>
  <p>This is what it gives me in the form of an array</p>
  <p>[0] =&gt; &lt; loc &gt;http://address.com&lt; /loc &gt;</p>
  <p>Now I want to Remove &lt; loc &gt; AND &lt; / loc &gt; from the output and get only the single url</p>
  <p>Then I just want to find url Which is so</p>
  <p><a href="http://address.com/index.aspx?Product=" rel="nofollow noreferrer">http://address.com/index.aspx?Product=</a></p>
  <p>I only want URLs where this word exists? Product =</p>