Skip to content

Instantly share code, notes, and snippets.

@peter279k
Last active August 8, 2020 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peter279k/1c54d7a948d26aa252462c167a187824 to your computer and use it in GitHub Desktop.
Save peter279k/1c54d7a948d26aa252462c167a187824 to your computer and use it in GitHub Desktop.
UDN Voting for funny.
<?php
require_once './vendor/autoload.php';
use GuzzleHttp\Client;
$voteUrl = 'https://udn.com/func/vote/?act_code=v853';
$client = new Client(['cookies' => true]);
$response = $client->request('GET', $voteUrl);
echo (string)$response->getBody();
$randomImgUrl = 'https://udn.com/funcap/keyimg';
$randomImg = $client->request('GET', $randomImgUrl);
file_put_contents('./keyimg.jpg', (string)$randomImg->getBody());
exec('tesseract ./keyimg.jpg code');
$code = file_get_contents('./code.txt');
preg_match('/(\d+)/', $code, $matched);
$code = $matched[0];
$postVoteUrl = 'https://udn.com/funcap/vote/votingJson.jsp';
$json = [
'code' => $code,
'choice' => [2],
'id' => 'v853',
'email' => '',
'g_token' => null,
];
$headers = [
'User-Agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
];
$response = $client->request('POST', $postVoteUrl, [
'json' => $json,
'headers' => $headers,
]);
var_dump((string)$response->getBody());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment