Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $forumId = 51; // Par exemple 51 (18-25), trouvable dans l'URL du forum
- $forumSlug = "blabla-18-25-ans"; // Trouvable à la fin de l'URL de la liste des sujets d'un forum
- $username = "Votre pseudo";
- $userpassword = "Votre mot de passe";
- $message = <<<EOF
- first
- EOF;
- function query(string $uri, array $args = [], string $method = "GET") {
- $ts = date("c");
- $signature = "550c04bf5cb2b\n$ts\n$method\napi.jeuxvideo.com\n/v4/$uri\n";
- $signature = hash_hmac("sha256", $signature, "d84e9e5f191ea4ffc39c22d11c77dd6c");
- $header = "PartnerKey=550c04bf5cb2b, Signature=$signature, Timestamp=$ts";
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_URL, "https://api.jeuxvideo.com/v4/$uri");
- if (!empty($args))
- curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($args));
- if ($method != "GET")
- curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
- curl_setopt($curl, CURLOPT_HTTPHEADER, ["Jvc-Authorization: $header", "Content-Type: application/json"]);
- curl_setopt($curl, CURLOPT_USERAGENT, "JeuxVideo-Android/202");
- curl_setopt($curl, CURLOPT_TIMEOUT, 10);
- curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($curl, CURLOPT_HEADER, true);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $result = curl_exec($curl);
- curl_close($curl);
- return $result;
- }
- $page = query("accounts/login", ["alias" => $username, "password" => $userpassword], "POST");
- preg_match("`coniunctio=(.+);`isU", $page, $coniunctio);
- if (!isset($coniunctio[1]) || empty($coniunctio[1]))
- exit("Identifiants incorrects :(\n");
- echo "Hello world.\n";
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_COOKIE, "coniunctio={$coniunctio[1]}");
- curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36");
- curl_setopt($curl, CURLOPT_ENCODING, "gzip");
- curl_setopt($curl, CURLOPT_TIMEOUT, 10);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- $list = [];
- while(1) {
- curl_setopt($curl, CURLOPT_POST, false);
- curl_setopt($curl, CURLOPT_URL, "http://api.jeuxvideo.com/forums/0-$forumId-0-1-0-1-0-$forumSlug.htm");
- $page = curl_exec($curl);
- preg_match_all("`<a href=\"(.+)\" class=\"a-topic\">`isU", $page, $topics);
- $topics = $topics[1];
- unset($topics[0]);
- $topics = array_values($topics);
- preg_match_all("`<span class=\"nb-comm-topic\">\((.+)\)</span>`isU", $page, $responses);
- $responses = $responses[1];
- unset($responses[0]);
- $responses = array_values($responses);
- foreach ($topics as $id=>$topic) {
- if (!in_array($topic, $list) && $responses[$id] == 0) {
- $topicId = explode("-", $topic)[2];
- curl_setopt($curl, CURLOPT_URL, "http://api.jeuxvideo.com/forums/create_message.php?id_topic=$topicId");
- $page = curl_exec($curl);
- $tokens = [];
- $tokens = [];
- preg_match_all("`name=\"fs_(.+)\" value=\"(.+)\"/>`isU", $page, $tokensArray);
- for ($i = 0; $i <= count($tokensArray[1])-1; $i++)
- $tokens["fs_{$tokensArray[1][$i]}"] = $tokensArray[2][$i];
- $post = array_merge($tokens, ["form_alias_rang" => 1, "message_topic" => "first"]);
- curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
- curl_exec($curl);
- $list[] = $topic;
- sleep(10); // Délai minimum entre chaque message
- break;
- }
- }
- usleep(100000); // Pour éviter de dos jvc
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement