PHP code example of raitocz / pinger

1. Go to this page and download the library: Download raitocz/pinger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

raitocz / pinger example snippets


// As object:
$pinger = new Pinger();
$pinger->setUrls(array('http://localhost/'))
    ->setRepeat(100)
    ->setWait(1)
    ->start();
    
// As static method:
Pinger::run(array('http://localhost/'), 100, 1);

$urls = array(
    'http://localhost/1',
    'http://localhost/02',
    'http://localhost/003',
    'http://localhost/0004',    
);

Pinger::run($urls, 2, 1, Pinger::MODE_RANDOM);

$urls = array(
    'http://localhost/1',
    'http://localhost/02',
    'http://localhost/003',
    'http://localhost/0004',    
);

Pinger::run($urls, 2, 1, Pinger::MODE_RANDOM_NOREPEAT);

$urls = array(
    'http://localhost/1',
    'http://localhost/02',
    'http://localhost/003',
    'http://localhost/0004',    
);

Pinger::run($urls, 2, 1, Pinger::MODE_BATCH_URL);

$urls = array(
    'http://localhost/1',
    'http://localhost/02',
    'http://localhost/003',
    'http://localhost/0004',    
);

Pinger::run($urls, 2, 1, Pinger::MODE_BATCH_ARRAY);