zeg1jeux/lib/Fred.class.php

160 lines
4.4 KiB
PHP
Raw Permalink Normal View History

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
public function __construct () {
2022-10-21 21:26:41 +02:00
}
2022-10-21 21:26:41 +02:00
public function donneMoiLaPutainDeClefIPNS ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
2022-10-21 21:26:41 +02:00
$salt = $prenomNom;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
2022-10-21 21:26:41 +02:00
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) .'&getipns=yes';
2023-03-14 17:06:22 +01:00
$page1 = file_get_contents($this->gatewayProtocol . '://'. $this->gatewayDomain . $this->gatewayPort . '/?' . $query);
if (empty($page1)) {
2022-10-21 21:26:41 +02: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
preg_match("`url='([^']+)'`isU", $page1, $matches);
2023-03-14 18:07:15 +01:00
$urlipns = $matches[1];
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
if (empty($page2)) {
2022-10-21 21:26:41 +02: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
$ipnsKey = $matches[1];
2022-10-21 21:26:41 +02:00
return $ipnsKey;
}
2022-10-21 21:26:41 +02:00
public function donneMoiSesPutainDeMessagesGchange ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday, $gchangeName) {
2022-10-21 21:26:41 +02:00
$salt = $prenomNom;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
2022-10-21 21:26:41 +02:00
$query = 'salt='. $salt .'&pepper='. $pepper . '&messaging=' . $gchangeName;
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
if (empty($page1)) {
2022-10-21 21:26:41 +02: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
// echo '<pre>'; var_dump(htmlspecialchars($page1)); echo '</pre>';
2022-10-21 21:26:41 +02: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];
2023-03-14 18:07:15 +01:00
// echo '<pre>'; var_dump($urli); echo '</pre>';
$page2 = '';
$rounds = 0;
2022-10-21 21:26:41 +02:00
while (empty($page2) and $rounds < 10) {
sleep($this->gatewayDelay);
2023-03-14 18:07:15 +01:00
$page2 = file_get_contents($urlmessages);
}
if (empty($page2)) {
throw new Exception("J'ai pas pû récupérer la putain de deuxième page.");
}
// echo '<pre>'; var_dump(htmlspecialchars($page2)); echo '</pre>';
$json = $page2;
return json_decode($json);
}
public function donneMoiSaPutaindeG1Pub ($prenomNom, $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday) {
2022-11-14 15:45:55 +01:00
$salt = $prenomNom;
$pepper = $nomDuChienSuivieDeLaDateDeNaissanceDeJohnnyHallyday;
$query = 'salt='. urlencode($salt) .'&pepper='. urlencode($pepper) . '&getg1pub=yes';
2023-03-14 18:07:15 +01:00
$urlj = $this->gatewayProtocol . '://'. $this->gatewayDomain .':' . $this->gatewayPort . '/?' . $query;
2023-03-14 18:07:15 +01:00
// echo '<pre>'; var_dump(htmlspecialchars($urlj)); echo '</pre>';
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Accept-language: fr\r\n",
'follow_location' => 0
)
);
$context = stream_context_create($opts);
2023-03-14 18:07:15 +01:00
$page1 = file_get_contents($urlj, false, $context);
if (empty($page1)) {
throw new Exception("J'ai pas pû récupérer la putain de première page.");
}
// die('<pre>' . htmlspecialchars($page1) . '</pre>');
preg_match("`url='([^']+)'`isU", $page1, $matches);
// die(
// '<pre>' . htmlspecialchars($page1) . '</pre>' .
// '<pre>' . print_r($matches, true) . '</pre>'
// );
2023-03-14 18:07:15 +01:00
$urlg1pub = $matches[1];
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);
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);
$gchangeId = $matches[1];
return $gchangeId;
2023-03-14 17:28:35 +01:00
}
}