loop on PORT

This commit is contained in:
fred 2023-03-14 17:47:33 +01:00
parent e25914e36b
commit 5ab3381d5f
1 changed files with 17 additions and 5 deletions

View File

@ -8,7 +8,7 @@ class Fred {
private $gatewayPort = ''; // :1234
private $gatewayDelay = 5;
private $gatewayDelay = 3;
public function __construct () {
@ -32,15 +32,21 @@ class Fred {
$url = $matches[1];
sleep($this->gatewayDelay);
$page2 = '';
$rounds = 0;
$page2 = file_get_contents($url);
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
}
if (empty($page2)) {
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
}
preg_match("`url='.*/ipns/([^']+)'`isU", $page2, $matches);
$ipnsKey = $matches[1];
@ -138,15 +144,21 @@ class Fred {
$url = $matches[1];
sleep($this->gatewayDelay);
$page2 = '';
$rounds = 0;
$page2 = file_get_contents($url);
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
$page2 = file_get_contents($url);
}
if (empty($page2)) {
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
}
preg_match("`url='.*/user/([^']+)/'`isU", $page2, $matches);
$gchangeId = $matches[1];