cvs: docweb /scripts checkent.php

From: Date: Wed, 19 Jan 2005 20:56:50 +0000
Subject: cvs: docweb /scripts checkent.php
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-496@lists.php.net to get a copy of this message
vincent Wed Jan 19 15:56:50 2005 EDT Modified files: /docweb/scripts checkent.php Log: make some servers happy with a user-agent and sleep to prevent servers from blocking the script. Also added a counter http://cvs.php.net/diff.php/docweb/scripts/checkent.php?r1=1.5&r2=1.6&ty=u Index: docweb/scripts/checkent.php diff -u docweb/scripts/checkent.php:1.5 docweb/scripts/checkent.php:1.6 --- docweb/scripts/checkent.php:1.5 Wed Jan 19 15:38:33 2005 +++ docweb/scripts/checkent.php Wed Jan 19 15:56:49 2005 @@ -18,7 +18,7 @@ * | Docweb port: Nuno Lopes <nlopess@php.net> | * | Mehdi Achour <didou@php.net> | * +----------------------------------------------------------------------+ - * $Id: checkent.php,v 1.5 2005/01/19 20:38:33 nlopess Exp $ + * $Id: checkent.php,v 1.6 2005/01/19 20:56:49 vincent Exp $ */ set_time_limit(0); @@ -66,10 +66,13 @@ $errors = array(); +$numb = 0; // Walk through entities found foreach($entity_urls as $num => $entity_url) { - + $numb++; + sleep(7); // make some servers happy + // Get the parts of the URL $url = parse_url($entity_url); $entity = $entity_names[$num]; @@ -107,7 +110,7 @@ $errors[HTTP_CONNECT][] = array($num); } else { - fputs($fp, "HEAD {$url['path']} HTTP/1.0\r\nHost: {$url['host']}\r\nConnection: close\r\n\r\n"); + fputs($fp, "HEAD {$url['path']} HTTP/1.0\r\nHost: {$url['host']}\r\nConnection: close\r\nUser-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041207 Firefox/1.0\r\n\r\n"); $str = ''; while (!feof($fp)) { @@ -341,6 +344,7 @@ echo '</table>'; } +echo '<p>Checked ' . $numb . ' urls</p>'; echo '<?php echo site_footer(); ?>'; ?> \ No newline at end of file

« previous php.doc.web (#496) next »