Last active
August 8, 2020 15:03
-
-
Save peter279k/1c54d7a948d26aa252462c167a187824 to your computer and use it in GitHub Desktop.
UDN Voting for funny.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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