title: Parse a website, getting all the links and save into mysql database
body: <p>I'm working on PHP and MySQL along with PHP Simple HTML DOM Parser. I have to parse a website's pages and fetch some content. For that I put the homepage of website as an initial url and fetched all the anchor tags available on that page.</p>
  
  <p>I have to filter those urls as every link is not useful for me. So, I used regular expression. Required links must be saved into my mysql database.</p>
  
  <p>My questions are:</p>
  
  <ol>
  <li><p>If I extract all the links(around 1,20,000 links) and try to save into mysql DB, I'm getting the following error:
  Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\search-engine\index.php on line 12</p></li>
  <li><p>I can't store data into database.</p></li>
  <li><p>I couldn't filter links.</p>
  
  <pre><code>include('mysql_connection.php');
  include('simplehtmldom_1_5/simple_html_dom.php');
  $website_name="xyz.html/";
  
  $html=file_get_html("xyz.html/");
  foreach($html-&gt;find('div') as $div)
  {
      foreach($html-&gt;find('a') as $a_burrp)
      { 
      echo $a1 = $a_burrp-&gt;href . '&lt;br&gt;';
          if(preg_match('/.+?event.+/',$a1, $a_match))
          {
              mysql_query("INSERT INTO scrap_urls(url, website_name, date_added) VALUES(`$a1`, `$website_name`, now())";
          }
  
      }
  }
  </code></pre></li>
  </ol>