OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
breader
/
admin
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
11/07/2024 07:55:42 AM
rwxr-xr-x
📁
assets
-
08/15/2024 03:38:36 AM
rwxr-xr-x
📄
bbrss_feed_articles.php
4.58 KB
11/04/2024 12:39:16 PM
rw-r--r--
📁
css
-
08/15/2024 03:38:35 AM
rwxr-xr-x
📄
db_connect.php
261 bytes
11/06/2024 10:21:02 AM
rw-r--r--
📄
eSamudaay_rss_feed_articles.php
4.37 KB
10/01/2024 06:24:41 AM
rw-r--r--
📄
fetch_articles.html
317 bytes
08/15/2024 03:38:31 AM
rw-r--r--
📁
fonts
-
08/15/2024 03:38:32 AM
rwxr-xr-x
📁
images
-
08/15/2024 03:38:33 AM
rwxr-xr-x
📄
index.php
6.04 KB
08/15/2024 03:47:03 AM
rw-r--r--
📁
js
-
09/26/2024 05:03:24 AM
rwxr-xr-x
📄
l2.html
14.08 KB
08/15/2024 03:38:31 AM
rw-r--r--
📄
rss_feed_articles.php
8.54 KB
11/06/2024 10:45:28 AM
rw-r--r--
📄
rss_feed_store.php
3.77 KB
08/15/2024 03:38:31 AM
rw-r--r--
📁
scss
-
08/15/2024 03:38:35 AM
rwxr-xr-x
📄
test4.php
7.03 KB
11/06/2024 11:07:16 AM
rw-r--r--
📄
test5.php
4.6 KB
11/06/2024 10:03:04 AM
rw-r--r--
Editing: test4.php
Close
<?php ini_set('display_errors', 1); // Display errors on screen (useful for debugging) ini_set('display_startup_errors', 1); error_reporting(E_ALL); // Report all types of errors // Include database connection // include '../inc/db_connect.php'; include 'db_connect.php'; function fetch_article_image($url, $headers) { // Set up cURL options $ch = curl_init($url); // Set cURL options curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // To return the response as a string curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // To follow redirects if (!empty($headers)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // Add the headers to the request } curl_setopt($ch, CURLOPT_ENCODING, "gzip"); // Handle gzip encoding (if any) // Execute the cURL request $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'cURL Error: ' . curl_error($ch); curl_close($ch); return null; } // Check HTTP status code $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($http_code != 200) { echo "Error: HTTP status code " . $http_code; curl_close($ch); return null; } // Parse the HTML to extract the og:image URL preg_match('/<meta property="og:image" content="([^"]+)"/', $response, $matches); // Check if og:image meta tag was found if (isset($matches[1])) { // Return the image URL from the content attribute $image_url = $matches[1]; curl_close($ch); return $image_url; } else { echo "No og:image meta tag found."; curl_close($ch); return null; } } // Function to update image URLs function updateImageUrls($conn, $feedId) { // Prepare the SQL query $stmt = $conn->prepare('SELECT rfu.rss_publisher, rfa.url FROM rss_feeds_articles rfa INNER JOIN rss_feeds_url rfu ON rfu.rss_id = rfa.feed_id WHERE rfu.rss_id = ? AND rfa.image = ""'); // Bind the parameter to the statement $stmt->bind_param('i', $feedId); // Execute the query $stmt->execute(); // Get the result set from the query $result = $stmt->get_result(); if ($result) { // Check if there are rows returned if ($result->num_rows === 0) { echo "No articles found without images.\n"; return; // Exit the function if no articles are found } // Iterate over each row while ($row = $result->fetch_assoc()) { $url = $row['url']; // Make sure you use the correct key $publisher = $row['rss_publisher']; if ($publisher == "Business Standard") { // Set the headers as an associative array $headers = [ '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-Encoding: gzip, deflate, br, zstd', 'Accept-Language: en-US,en;q=0.9', 'Cache-Control: no-cache', 'Cookie: userUid=1728537242669-a5ca6796-c750-4a1e-b231-df307fea620e; _sid=MTcyODUzNzI0MjY3MC5icTc%3D; _cc_id=7d478f9881d57419250c84b6018df565; _gcl_au=1.1.1122819885.1728537245; _fbp=fb.1.1728537245555.590394025996360652; _ga=GA1.1.10526761.1728537246; WZRK_G=4a5933c8cab7473ba3140082d01d7953; _scor_uid=7f0388954ab348a4bd3d68ce53392684; panoramaId_expiry=1731320137322; panoramaId=8b90c705acaa6abbb51c0094f1ba4945a702bb8a4200481fafbc12babef0864b; panoramaIdType=panoIndiv; _sharedID=c04f607e-cbea-4db0-978d-d7867018f619; _sharedID_cst=zix7LPQsHA%3D%3D; _au_1d=AU1D-0100-001730715345-MFJ2CWIA-BRP0; _col_uuid=0b6160a5-e60c-4f03-a227-c9cd50d26aba-1sjac; __browsiSessionID=56cd45fe-045c-4f4d-9705-b864948193f0&false&DEFAULT&in&desktop-4.33.528&false; __browsiUID=b3963d2d-0474-4ea3-93f3-d47cf959bf6a; cto_bundle=16U0Xl8xNGhOQTY4azF2bXR6dlQyaGNZSE1BVHJRSnQ1bjZPWnh5TlNFWktobnc1SGxTZ3BRbWlKYzlKUGdNeGY2bWpOc3Qwc2pWUGJva01pbmZhQnNKdkp0RGZicXhQMiUyQmY0TWZrRmZZZ2JIJTJGTDJhSWs2Skg4bTg2bmVXeUp2NlFKbyUyQnI1cSUyQjIxVEwxMVhSUnZ2M0hndVlKSTklMkJUWXlTS1ZnQXBla3VCYkVKOE1JeGU5eThHYkdxRm9CbEQlMkJBYmk5UUwzTXRhZzdSSmtWVFQzZWMlMkZiRzREREpleE1vRzFqMEdYaiUyQk1NbWR5Z3QxcyUzRA; _ga_FVWZ0RM4DH=GS1.1.1730782577.3.0.1730782577.60.0.0; __gads=ID=6a23964e97fec96a:T=1728537244:RT=1730782580:S=ALNI_MZYLRNxbAx_y1QY4uc9UF0EYXaF5w; __gpi=UID=00000f3cbeee4b38:T=1728537244:RT=1730782580:S=ALNI_MYThSwlIGyOu6mp1_oesek2JBWN3Q; __eoi=ID=3ee9373ac52cb278:T=1728537244:RT=1730782580:S=AA-AfjaNuBiiRJNoYjzEjQNcHl1e; _ga_KRGL1M61LX=GS1.1.1730781216.5.1.1730782582.55.0.0', 'Pragma: no-cache', 'Priority: u=0, i', 'Sec-CH-UA: "Chromium";v="130", "Google Chrome";v="130", "Not?A_Brand";v="99"', 'Sec-CH-UA-Mobile: ?1', 'Sec-CH-UA-Platform: "Android"', 'Sec-Fetch-Dest: document', 'Sec-Fetch-Mode: navigate', 'Sec-Fetch-Site: none', 'Sec-Fetch-User: ?1', 'Upgrade-Insecure-Requests: 1', 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36' ]; } else { $headers = []; } // Check if URL is valid if (!empty($url)) { $imageUrl = fetch_article_image($url, $headers); if ($imageUrl) { // Update the image URL in the database $updateStmt = $conn->prepare("UPDATE rss_feeds_articles SET image = ? WHERE url = ?"); if ($updateStmt) { $updateStmt->bind_param("ss", $imageUrl, $url); $updateStmt->execute(); echo "Updated image URL for $url: $imageUrl<br>"; $updateStmt->close(); // Close the statement } else { echo "Failed to prepare update statement: " . $conn->error . "<br>"; } } else { echo "No image found for $url.<br>"; } } else { echo "URL is empty for one of the articles.<br>"; } } } else { echo "Query failed: " . $conn->error . "<br>"; } } $sql = "SELECT rss_id FROM rss_feeds_url"; $result = $conn->query($sql); $restrictedIds = [17,11,8]; if ($result->num_rows > 0) { // Loop through each row in the result set foreach ($result as $row) { echo "RSS ID: " . $row['rss_id'] . "<br>"; if(!in_array($row['rss_id'], $restrictedIds)){ updateImageUrls($conn,$row['rss_id']); } } } else { echo "No results found."; } // updateImageUrls($conn, 18); $conn->close(); echo "Articles Updated Successfully at " . date('Y-m-d H:i:s') . "\n";