Last active
June 7, 2023 11:57
-
-
Save patriksh/981d409517527ad70cc548f88f5b4767 to your computer and use it in GitHub Desktop.
Call of Duty 1.1x screenshots example script
This file contains 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 | |
$webhookUrl = 'YOUR DISCORD WEBHOOK URL'; | |
$targetFile = './' . basename($_FILES['ss']['name']); | |
$uploadOk = (getimagesize($_FILES['ss']['tmp_name']) !== false); | |
$uploadOk = (strtolower(pathinfo($targetFile, PATHINFO_EXTENSION)) == 'jpg'); | |
if(!$uploadOk) die; | |
move_uploaded_file($_FILES['ss']['tmp_name'], $targetFile); | |
$data = [ | |
'content' => 'New screenshot! Player: `' . $_POST['player'] . '`.', | |
'file' => new CURLFile($targetFile) | |
]; | |
$ch = curl_init($webhookUrl); | |
curl_setopt_array($ch, [ | |
CURLOPT_POST => true, | |
CURLOPT_POSTFIELDS => $data, | |
CURLOPT_RETURNTRANSFER => true, | |
]); | |
curl_exec($ch); | |
curl_close($ch); | |
unlink($targetFile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment