https://github.com/raitocz/pinger
Tiny PHP library used to ping desired URLs
https://github.com/raitocz/pinger
flood ping pinger polls spam
Last synced: 5 months ago
JSON representation
Tiny PHP library used to ping desired URLs
- Host: GitHub
- URL: https://github.com/raitocz/pinger
- Owner: raitocz
- License: mit
- Created: 2017-10-13T06:00:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-07T10:00:37.000Z (almost 6 years ago)
- Last Synced: 2024-11-18T09:56:00.095Z (over 1 year ago)
- Topics: flood, ping, pinger, polls, spam
- Language: PHP
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Pinger
[](https://github.com/raitocz/pinger)
[](https://github.com/raitocz/pinger)
[](https://github.com/raitocz/pinger)
- [Installation](#installation)
- [Introduction](#introduction)
- [Basic usage](#basic-usage)
## Installation
`composer require raitocz/pinger`
## Introduction
**This project is under development, it is recommended to wait with usage for stable release (soon).**
Tiny PHP library used to ping desired URLs. You can use proxy list to ping as from different computer making this tool
handy when you wan to test the server load from different IPs. Use at your own risk, you can DDoS yourself or get
blacklisted for attacking another server.
The user agent is generated from random numbers so the server is tricked to be believing that each request came from
different computer (although from same IP if no proxy list specified).
This script is working well for example with unprotected polls for adding votes (ones where links are not generated
for each page reload) as this was the reason why it was created & later transformed to this library.
## Warnings
This script can also clog your computer fast as it is making each request as separate PHP process, so too fast settings
can flood your RAM. That's why the Wait time is in Seconds. Although you can set it for example to 0.000001 I highly
don't recommend that. Setting it to 0.1 will flood free 16GB RAM in few seconds, for example.
Please also note the limitations of Windows systems for usleep() which is used:
http://php.net/manual/en/function.usleep.php
## Basic usage
Simplest request to one url 100x each second:
```php
// 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);
```
Here are examples of diferent modes (used only static method for shorter code):
#### Random mode (default)
```php
$urls = array(
'http://localhost/1',
'http://localhost/02',
'http://localhost/003',
'http://localhost/0004',
);
Pinger::run($urls, 2, 1, Pinger::MODE_RANDOM);
```
result:
```text
ping: http://localhost/003
ping: http://localhost/0004
ping: http://localhost/003
ping: http://localhost/1
ping: http://localhost/0004
ping: http://localhost/1
ping: http://localhost/02
ping: http://localhost/02
```
#### Random mode No repeat
```php
$urls = array(
'http://localhost/1',
'http://localhost/02',
'http://localhost/003',
'http://localhost/0004',
);
Pinger::run($urls, 2, 1, Pinger::MODE_RANDOM_NOREPEAT);
```
result:
```text
ping: http://localhost/1
ping: http://localhost/003
ping: http://localhost/0004
ping: http://localhost/02
ping: http://localhost/003
ping: http://localhost/0004
ping: http://localhost/1
ping: http://localhost/02
```
#### Batch URL
```php
$urls = array(
'http://localhost/1',
'http://localhost/02',
'http://localhost/003',
'http://localhost/0004',
);
Pinger::run($urls, 2, 1, Pinger::MODE_BATCH_URL);
```
result:
```text
ping: http://localhost/1
ping: http://localhost/1
ping: http://localhost/02
ping: http://localhost/02
ping: http://localhost/003
ping: http://localhost/003
ping: http://localhost/0004
ping: http://localhost/0004
```
#### Batch Array
```php
$urls = array(
'http://localhost/1',
'http://localhost/02',
'http://localhost/003',
'http://localhost/0004',
);
Pinger::run($urls, 2, 1, Pinger::MODE_BATCH_ARRAY);
```
result:
```text
ping: http://localhost/1
ping: http://localhost/02
ping: http://localhost/003
ping: http://localhost/0004
ping: http://localhost/1
ping: http://localhost/02
ping: http://localhost/003
ping: http://localhost/0004
```