$url = 'https://forums.kentuckywrestling.com/index.php?/forum/50-events-marketplace/&do=add';
$boundary = '----WebKitFormBoundaryAAeOFmlHzR34b9t3';
// Data POST yang dikirim
$data = [
'form_submitted' => '1',
'csrfKey' => $csrfKey,
'MAX_FILE_SIZE' => '67108864',
'plupload' => '1d1ec0d9d63cb872b1d52078da63b8cd',
'topic_title' => $title,
'topic_tags_original' => '',
'topic_tags' => '',
'topic_tags_prefix' => '',
'topic_content' => $Content,
'topic_content_upload' => 'cdf1bcd0fe0c5d834241342f8d0ee2c9',
'topic_auto_follow' => '0',
'topic_poll[title]' => '',
'topic_poll[poll_close_date]' => '2026-08-27',
'topic_poll[poll_close_time]' => '23:53',
'topic_poll[questions][1][title]' => '',
'topic_poll[questions][1][answers][1][value]' => '',
'topic_poll[questions][1][answers][2][value]' => '',
];
// Bangun data POST
$postFields = '';
foreach ($data as $key => $value) {
$postFields .= "--$boundary\r\n";
$postFields .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
$postFields .= "$value\r\n";
}
$postFields .= "--$boundary--\r\n";
// Inisialisasi sesi cURL
$ch = curl_init($url);
// Atur opsi cURL
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Accept-Language: en-US,en;q=0.9',
'Cache-Control: max-age=0',
'Content-Type: multipart/form-data; boundary=' . $boundary,
'Cookie: ' . $stringcookie,
'Origin: https://forums.kentuckywrestling.com',
'Referer: https://forums.kentuckywrestling.com',
'Sec-CH-UA: "Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
'Sec-CH-UA-Mobile: ?0',
'Sec-CH-UA-Platform: "macOS"',
'Sec-Fetch-Dest: document',
'Sec-Fetch-Mode: navigate',
'Sec-Fetch-Site: same-origin',
'Sec-Fetch-User: ?1',
'Upgrade-Insecure-Requests: 1',
'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
]);
$headers = [];
curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($ch, $header) use (&$headers) {
$length = strlen($header);
if (stripos($header, 'Location:') === 0) {
$headers[] = trim(substr($header, 9));
}
return $length;
});
$retry = true;
while ($retry) {
// Eksekusi permintaan cURL
$response = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error: ' . curl_error($ch);
break;
}
// Cek apakah ada pesan tentang batas waktu
if (preg_match('/<span class="ipsType_warning">New posts within a short time frame are limited. Please wait (\d+) seconds before submitting.<\/span>/', $response, $matches)) {
// Ambil waktu tunggu dan tidurkan
$waitTime = (int)$matches[1];
echo "Please wait for $waitTime seconds before retrying.<br/>";
sleep($waitTime);
} else {
// Menampilkan response
echo "<textarea style='width:100%;height:300px;'>$response</textarea>";
$retry = false; // Selesai jika tidak ada lagi batas waktu
}
}
// Tutup sesi cURL
curl_close($ch);
// Tampilkan URL redirect jika ada
if (!empty($headers)) {
echo '<br/><div id="hasil">' . end($headers) . '</div>';
echo 'Redirect URL: ' . end($headers);
} else {
echo '<br/><div id="hasil">failed</div>';
}
}