📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
blogscripti.demodesign.com.tr
/
admin
📝
botcron.php
← Geri Dön
<?php include('inc/config.php'); $botData = $db->query("SELECT * FROM content_bot")->fetchAll(PDO::FETCH_ASSOC); foreach ($botData as $data) { $url = $data['url']; $category_id = $data['category_id']; $rssLink = $url; $rssData = file_get_contents($rssLink); $rssXml = simplexml_load_string($rssData); foreach ($rssXml->channel->item as $item) { $guid = $item->title; $stmt = $db->prepare("SELECT * FROM blog WHERE baslik = :guid"); $stmt->bindParam(':guid', $guid); $stmt->execute(); $existingEntry = $stmt->fetch(PDO::FETCH_ASSOC); if (!$existingEntry) { $title = $item->title; $description = $item->description; $coco = $item->children("http://purl.org/rss/1.0/modules/content/")->encoded; $icerik = $coco; // Find all <img> tags with src attribute in the content $pattern = '/<img.*?src=["\'](.*?)["\'].*?>/i'; preg_match_all($pattern, $icerik, $matches); // Get the image URLs $imageURLs = $matches[1]; // Get the server name $serverName = $_SERVER['SERVER_NAME']; // Process and replace the images in the content foreach ($imageURLs as $imageURL) { $imageName = basename($imageURL); // Get the filename from the URL $imagePath = $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $imageName; $webpFilename = seolink($title) . '-' . uniqid() . '.webp'; // Generate WebP filename using title $webpPath = '../uploads/' . $webpFilename; file_put_contents($imagePath, file_get_contents($imageURL)); $imageGD = imagecreatefromstring(file_get_contents($imagePath)); imagewebp($imageGD, $webpPath, 80); $newImageURL = 'https://' . $serverName . '/uploads/' . $webpFilename; $icerik = str_replace($imageURL, $newImageURL, $icerik); imagedestroy($imageGD); unlink($imagePath); } $pattern = '/<img.*?src=["\'](.*?)["\'].*?>/i'; preg_match($pattern, $icerik, $matches); if (isset($matches[1])) { $featuredImage = $matches[1]; $icerik = preg_replace($pattern, '', $icerik, 1); } preg_match($pattern, $coco, $matches); $image = isset($matches[1]) ? $matches[1] : ''; $image_name = basename($image); $kategori = '1'; $data = [ 'baslik' => $title, 'icerik' => $icerik, 'seobaslik' => $title, 'seodescription' => substr($description, 0, 150), 'seolink' => seolink($title), 'kategori' => $kategori, 'tur' => 'blog' ]; // Resmi indir ve WebP'ye dönüştür if (!empty($image)) { $image_path = $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $image_name; file_put_contents($image_path, file_get_contents($image)); // WebP'ye dönüştürme $webp_destination = '../uploads/' . uniqid() . '.webp'; $image_gd = imagecreatefromstring(file_get_contents($image_path)); imagewebp($image_gd, $webp_destination, 80); // Resim yolunu güncelle $data['resim'] = $webp_destination; // Önbellekteki resmi serbest bırak imagedestroy($image_gd); // Orjinal resmi sil unlink($image_path); } $veriyaz = $db->prepare("INSERT INTO blog SET baslik=:baslik, icerik=:icerik, seobaslik=:seobaslik, seodescription=:seodescription, seolink=:seolink, resim=:resim, kategori=:kategori, tur=:tur "); $veriyaz->execute($data); $mesaj = '<div class="alert alert-success">RSS İçeriği başarıyla çekildi.</div>'; } else { $mesaj = '<div class="alert alert-danger">Bu RSS girdisi zaten veritabanında kaydedilmiş.</div>'; } } } ?>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula