0

I use OctoberCMS and have this code in a backend of a page which gets all links from specific page

$html = file_get_contents("http://somepage.com/");
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html);
libxml_clear_errors();
$xpath = new DOMXPath($doc);
foreach ($doc->getElementsByTagName('a') as $link){
      if (parse_url($link->getAttribute('href'), PHP_URL_SCHEME) === 'https') {
          $links[] = array('url' => $link->getAttribute('href'));
      }
      $haystack = $link->getAttribute('href');
      $needle   = "ht";
      if( strpos( $haystack, $needle ) !== false ) {
          echo $haystack."<br>";
      }
      else
      {
          continue;
      }
}

But whenever I try to load the page itself,which has only 2 links, I get constant loops and page won't load at all, resulting server to return an SQLSTATE[HY000] [1203] User ahmcho_ahmad already has more than 'max_user_connections' active connections error to me. I do not understand why I get this error?

Dmitry
  • 6,716
  • 14
  • 37
  • 39
  • its not error with your Laravel code, its problem with your DB user. – Bhaumik Pandhi Sep 07 '17 at 14:47
  • Please check this links, [first](https://dba.stackexchange.com/questions/47131/how-to-get-rid-of-maximum-user-connections-error), [second](https://stackoverflow.com/questions/4079531/mysqli-error-user-already-has-more-than-max-user-connections-active-connectio) – Bhaumik Pandhi Sep 07 '17 at 14:48

0 Answers0