0

I try to check HTTP status in cycle:

foreach ($arrayOfLinks as $link) {

    $this->getMainContext()->getSubcontext('mink')->visit($link);
    $statusCode = $this->getSession()->getStatusCode();
    if ($statusCode < 200 || $statusCode > 299) {
        print 'Broken link ' . $href . ' status code is ' . $statusCode . "\n";
    }

}

In the cycle it does not work consistently. It successfully checks about 20-40 links and then fails with error

The current node list is empty.

How can I fix it and what means this error?

Pac Rauce
  • 229
  • 1
  • 5
  • 11
  • I resolved problem. When I looking for all links on page and check status in the same foreach - I get error. When I split cycle into two cycles - it works – Pac Rauce Dec 23 '15 at 14:02

1 Answers1

0

I resolved problem. When I looking for all links on page and check status in the same foreach - I get error. When I split cycle into two cycles - it works

Pac Rauce
  • 229
  • 1
  • 5
  • 11