title: Fatal Error: Cannot redeclare file_get_contents_curl() using mysql, php, curl function. Please
body: <p>I have this script that i'm using to pull meta tag data from a few sites I own. I'm trying to display 6 total articles from 3 different sites. This script works, but I can only get it to display 1 article even though my limit is set at 6. Can anyone help please? </p>
  
  <pre><code>&lt;?PHP
  $sql_url = "SELECT * FROM db WHERE`approved` = 1 ORDER BY id DESC LIMIT 6";
  $query_url = mysql_query($sql_url); 
  echo(mysql_error());
  while($result_url = mysql_fetch_assoc($query_url)){
  
  function file_get_contents_curl($url)
  {
  $ch = curl_init();
  
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  
  $data = curl_exec($ch);
  curl_close($ch);
  
  return $data;
  }
  
  $html = file_get_contents_curl ($result_url['url']);
  
  //parsing begins here:
  $doc = new DOMDocument();
  @$doc-&gt;loadHTML($html);
  $nodes = $doc-&gt;getElementsByTagName('title');
  
  //get and display what you need:
  $title = $nodes-&gt;item(0)-&gt;nodeValue;
  
  $metas = $doc-&gt;getElementsByTagName('meta');
  
  for ($i = 0; $i &lt; $metas-&gt;length; $i++)
  {
  $meta = $metas-&gt;item($i);
  if($meta-&gt;getAttribute('property') == 'og:description')
      $description = $meta-&gt;getAttribute('content');
  if($meta-&gt;getAttribute('property') == 'og:image')
      $image = $meta-&gt;getAttribute('content');
  } 
  ?&gt;
  
              &lt;article&gt;
                  &lt;a href="#"&gt;&lt;?echo "&lt;img src='$image' alt='$description' style='width:280px;'&gt;";?&gt;&lt;/a&gt;
                  &lt;h1&gt;&lt;? echo "$title";?&gt;&lt;/h1&gt;
                  &lt;p&gt;&lt;? echo "$description";?&gt;&lt;/p&gt;
                  &lt;a href="#" class="readmore"&gt;Read more&lt;/a&gt;
              &lt;/article&gt;
  &lt;?}?&gt;
  </code></pre>
  
  <p>I'm currently getting this error
  <strong>Fatal Error:</strong> Cannot redeclare file_get_contents_curl() (previously declared in /index.php:53) in /index.php on line 53</p>