| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/public_html/bway/oldfeeds/ |
Upload File : |
<?php
// Set a timeout limit for the script execution
set_time_limit(500);
require_once __DIR__ . '/mysql_tls.php';
// Database connection (write)
$link = oldfeeds_mysqli_connect('amazonaurora.cluster-cemzxojvmybt.us-east-1.rds.amazonaws.com', 'admin', 'xxatN6Lb8Kbwb9MiU1At');
mysqli_select_db($link, 'amazonrds');
// Fetch the BroadwayStars.com HTML page
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://broadwaystars.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; BroadwayWorld/1.0)');
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
$htmlContent = curl_exec($ch);
curl_close($ch);
if (empty($htmlContent)) {
echo "Failed to fetch page content.";
exit;
}
// Regex pattern to extract news items
$pattern = '/<div class="single_news_box"><h3><a .*?href="(.*?)".*?>(.*?)<\/a><span id=".*?" title="(.*?)"> .*?<\/span><\/h3><p id=".*?">(.*?)<\/p><span class="courtesy">SOURCE: <a href=".*?">(.*?)<\/a>/s';
preg_match_all($pattern, $htmlContent, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
$itemLink = $match[1];
$title = $match[2];
$author = $match[3];
$description = $match[4];
$source = $match[5];
echo "<p><strong>Link:</strong> <a href=\"" . htmlspecialchars($itemLink) . "\">" . htmlspecialchars($itemLink) . "</a></p>";
echo "<p><strong>Title:</strong> " . htmlspecialchars($title) . "</p>";
echo "<p><strong>Author:</strong> " . htmlspecialchars($author) . "</p>";
echo "<p><strong>Description:</strong> " . htmlspecialchars($description) . "</p>";
echo "<p><strong>Source:</strong> " . htmlspecialchars($source) . "</p>";
// Check if title or link already exists
$checker_query = "SELECT COUNT(*) AS counter FROM feedmaster WHERE title = '" . mysqli_real_escape_string($link, $title) . "' OR link = '" . mysqli_real_escape_string($link, $itemLink) . "'";
$checker = mysqli_query($link, $checker_query);
if (!$checker) {
echo "<p>Query error: " . mysqli_error($link) . "</p>";
echo "<hr>";
continue;
}
$checker_result = mysqli_fetch_assoc($checker);
if ($checker_result['counter'] == 0 && stripos($itemLink, 'broadwayworld') === false) {
echo "<p>INSERT delayed INTO feedmaster(feedid,userid,processed,publisheddate,content,image,title,link,feedname) values(0,26,'0','" . date("Y-m-d H:i:s") . "','" . mysqli_real_escape_string($link, $description) . "','','" . mysqli_real_escape_string($link, $title) . "','" . mysqli_real_escape_string($link, $itemLink) . "','" . mysqli_real_escape_string($link, $source) . "')</p>";
$insert_query = "INSERT INTO feedmaster (feedid, userid, processed, publisheddate, content, image, title, link, feedname) VALUES (0, 26, '0', '" . date("Y-m-d H:i:s") . "', '" . mysqli_real_escape_string($link, $description) . "', '', '" . mysqli_real_escape_string($link, $title) . "', '" . mysqli_real_escape_string($link, $itemLink) . "', '" . mysqli_real_escape_string($link, $source) . "')";
mysqli_query($link, $insert_query);
} else {
echo "dupe!";
}
echo "<hr>";
}
// Close database connection
mysqli_close($link);
?>