2022-10-21 21:26:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class Fred {
|
|
|
|
|
2023-03-14 15:31:12 +01:00
|
|
|
private $gatewayProtocol = 'https';
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-04-16 23:42:45 +02:00
|
|
|
private $gatewayDomain = 'astroport.copylaradio.com';
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 17:06:22 +01:00
|
|
|
private $gatewayPort = ''; // :1234
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 18:23:25 +01:00
|
|
|
private $gatewayDelay = 6;
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
public function __construct () {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$salt = $prenomNom;
|
|
|
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) .'&getipns=yes';
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 17:06:22 +01:00
|
|
|
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain . $this->gatewayPort . '/?' . $query);
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
if (empty($page1)) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$urlipns = $matches[1];
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 17:47:33 +01:00
|
|
|
$page2 = '';
|
|
|
|
$rounds = 0;
|
|
|
|
|
|
|
|
while (empty($page2) and $rounds < 10) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 17:47:33 +01:00
|
|
|
sleep($this->gatewayDelay);
|
2023-03-14 18:07:15 +01:00
|
|
|
$page2 = file_get_contents($urlipns);
|
2023-03-14 17:47:33 +01:00
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
if (empty($page2)) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-15 05:35:44 +01:00
|
|
|
$ClearText = preg_replace( "/\n\s+/", "\n", rtrim(html_entity_decode(strip_tags($page2))) );
|
|
|
|
preg_match("`url='([^']+)'`isU", $ClearText, $matches);
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$ipnsKey = $matches[1];
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
return $ipnsKey;
|
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$salt = $prenomNom;
|
|
|
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName;
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query);
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
if (empty($page1)) {
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
|
|
|
}
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$urlmessages = $matches[1];
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
// echo '<pre>'; var_dump($urli); echo '</pre>';
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$page2 = '';
|
|
|
|
$rounds = 0;
|
2022-10-21 21:26:41 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
while (empty($page2) and $rounds < 10) {
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
sleep($this->gatewayDelay);
|
2023-03-14 18:07:15 +01:00
|
|
|
$page2 = file_get_contents($urlmessages);
|
2023-03-14 14:19:36 +01:00
|
|
|
}
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
if (empty($page2)) {
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
|
|
|
}
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$json = $page2;
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
return json_decode($json);
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
}
|
2022-11-07 01:20:25 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
|
2022-11-14 15:45:55 +01:00
|
|
|
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$salt = $prenomNom;
|
|
|
|
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getg1pub=yes';
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$urlj = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
// echo '<pre>'; var_dump(htmlspecialchars($urlj)); echo '</pre>';
|
2022-11-07 01:20:25 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$opts = array(
|
|
|
|
'http'=>array(
|
|
|
|
'method'=>"GET",
|
|
|
|
'header'=>"Accept-language: fr\r\n",
|
|
|
|
'follow_location' => 0
|
|
|
|
)
|
|
|
|
);
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
$context = stream_context_create($opts);
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$page1 = file_get_contents($urlj, false, $context);
|
2022-10-22 18:35:53 +02:00
|
|
|
|
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
if (empty($page1)) {
|
2022-11-07 01:20:25 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de première page.");
|
|
|
|
}
|
2022-11-07 01:20:25 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
|
2022-11-15 19:46:02 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
preg_match("`url='([^']+)'`isU", $page1, $matches);
|
2022-11-07 01:20:25 +01:00
|
|
|
|
2023-03-14 14:19:36 +01:00
|
|
|
// die(
|
|
|
|
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
|
|
|
|
// '<pre>' . print_r($matches, true) . '</pre>'
|
|
|
|
// );
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 18:07:15 +01:00
|
|
|
$urlg1pub = $matches[1];
|
2022-10-22 18:35:53 +02:00
|
|
|
|
2023-03-14 17:47:33 +01:00
|
|
|
$page2 = '';
|
2023-03-14 18:19:27 +01:00
|
|
|
sleep($this->gatewayDelay);
|
|
|
|
$page2 = file_get_contents($urlg1pub);
|
2023-03-14 14:19:36 +01:00
|
|
|
|
|
|
|
if (empty($page2)) {
|
|
|
|
|
|
|
|
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
|
|
|
|
}
|
|
|
|
|
2023-03-15 05:35:44 +01:00
|
|
|
$ClearText = preg_replace( "/\n\s+/", "\n", rtrim(html_entity_decode(strip_tags($page2))) );
|
|
|
|
preg_match("`url='([^']+)'`isU", $ClearText, $matches);
|
2023-03-14 14:19:36 +01:00
|
|
|
|
|
|
|
$gchangeId = $matches[1];
|
|
|
|
|
|
|
|
return $gchangeId;
|
2023-03-14 17:28:35 +01:00
|
|
|
}
|
2023-03-14 14:19:36 +01:00
|
|
|
}
|