@@ 180-189 (lines=10) @@ | ||
177 | $robotstxt = explode("\n", $robotstxt); |
|
178 | $result = []; |
|
179 | foreach ($robotstxt as $line) { |
|
180 | if (preg_match('/^\s*Sitemap:(.*)/i', $line, $match)) { |
|
181 | $urlsitemap = trim($match[1]); |
|
182 | $response = $this->client->get($urlsitemap, ['exceptions' => false]); |
|
183 | if ($response->getStatusCode() != 200) { |
|
184 | $result['sitemap']['error'][] = $urlsitemap; |
|
185 | } else { |
|
186 | $result['sitemap']['ok'][$urlsitemap] = $this->checkSitemap($response->getBody()->getContents()); |
|
187 | } |
|
188 | } |
|
189 | ||
190 | if (preg_match('/^\s*Disallow:(.*)/i', $line, $match)) { |
|
191 | $urldisallow = trim($match[1]); |
|
192 | $response = $this->client->get($urldisallow, ['exceptions' => false]); |
|
@@ 190-198 (lines=9) @@ | ||
187 | } |
|
188 | } |
|
189 | ||
190 | if (preg_match('/^\s*Disallow:(.*)/i', $line, $match)) { |
|
191 | $urldisallow = trim($match[1]); |
|
192 | $response = $this->client->get($urldisallow, ['exceptions' => false]); |
|
193 | if (($response->getStatusCode() != 200) && ($response->getStatusCode() != 403)) { |
|
194 | $result['disallow']['error'][] = $urldisallow; |
|
195 | } else { |
|
196 | $result['disallow']['ok'][] = $urldisallow; |
|
197 | } |
|
198 | } |
|
199 | } |
|
200 | ||
201 | return $result; |