title: web scrape php with clickable links
body: <p>I'm trying to do a fun little project where I basically take headlines for ex from a news site, scrape it/mirror it onto an additional site using php, and then have that data that is displayed on the new site actually be clickable links to the original site. if that's a bit confusing, let me show an example.</p>
  
  <p><a href="http://www.wilsonschlamme.com/test.php" rel="nofollow noreferrer">http://www.wilsonschlamme.com/test.php</a>
  Right there, I'm using php to scrape all data from the antrimreview (local michigan news site) contained in a &lt; span=class >.
  I chose span class, because that's where their headlines are located. I'm just using antrim for testing purposes, I have no affiliation with them.</p>
  
  <p>*What I'm wondering is, and what I don't know how to do, is actually make these headlines that are re displaying on my test site, as clickable links. In other words, retain the &lt; a href > of these headlines that contain clickable links to the full articles. Put differently, on the antrim website, those headlines are clickable links to full pages. When mirrored on my test website presently, there's clearly no links, because there's nothing grabbing the  data.</p>
  
  <p>Does anyone know how this could be done? or any thoughts? Would really appreciate it, this is a fun project, just lacking the knowledge on how to complete it.</p>
  
  <p>Oh and i know the pokemon references are lolsy down below. It's because I'm working with code originally from a tutorial somewhere lol: </p>
  
  <pre><code>&lt;?php
  $html = file_get_contents('http://www.antrimreview.net/'); //get the html 
  returned from the following url
  
  $pokemon_doc = new DOMDocument();
  
  libxml_use_internal_errors(TRUE); //disable libxml errors
  
  if(!empty($html)){ //if any html is actually returned
  
  $pokemon_doc-&gt;loadHTML($html);
  libxml_clear_errors(); //remove errors for yucky html
  
  $pokemon_xpath = new DOMXPath($pokemon_doc);
  
  //get all the h2's with an id
  $pokemon_row = $pokemon_xpath-&gt;query('//span[@class]');
  
   if($pokemon_row-&gt;length &gt; 0){
    foreach($pokemon_row as $row){
        echo $row-&gt;nodeValue . "&lt;br/&gt;";
    }
   }
   }
   ?&gt;
  </code></pre>