Help:Repairing SMW's data/hitURL.php


To hit a URL a large number of times in succession, in order to trigger its jobs to run more quickly, without having to simply reload the browser many times, you can use the following PHP script. Just copy the contents below into a file called "hitURL.php", within any environment that has PHP enabled, and call it like the following:

php hitURL.php 100

The first argument is the URL of the wiki to be hit, and the second is the number of times to hit it.

The code[edit]


if ( count( $argv ) != 3 ) {
	die( "Usage: php hitURL.php URL number-of-times\n" );

$url = $argv[1];
$numHits = $argv[2];

print "Hitting $url $numHits times";

for ( $i = 1; $i <= $numHits; $i++ ) {
	$contents = file_get_contents( $url );
	print ".";

print "\nDone.\n";