Skip to content

Instantly share code, notes, and snippets.

@stil stil/gist:5694720
Last active Dec 18, 2015

Embed
What would you like to do?
Refill energy every 30-90 minutes in eRepublik. Run on your server and keep running 24/7.
<?php
require __DIR__.'/vendor/autoload.php';
use Erpk\Harvester\Client\Client;
use Erpk\Harvester\Module\Management\ManagementModule;
$client = new Client;
$client->setEmail('email@address.com');
$client->setPassword('password');
$client->setUserAgent('Opera/9.80 (Windows NT 6.1; Win64; x64) Presto/2.12.388 Version/12.15');
$management = new ManagementModule($client);
while (true) {
$waitSeconds = mt_rand(1800, 5400);
$wakeupAt = time() + $waitSeconds;
try {
$result = $management->eat();
echo 'Health: '.$result['health'].PHP_EOL;
} catch (\Exception $e) {
echo $e->getMessage().PHP_EOL;
}
echo 'Next refill at '.gmdate('r', $wakeupAt).'.'.PHP_EOL;
time_sleep_until($wakeupAt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.