evet url olarak ekledi tek sorun url sonuna şunlar geliyor %0A
<?php
$host = "localhost";
$dbname = "xxxxx";
$username = "xxxxx";
$password = "xxxxx";
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Veritabanı hatasi" . $e->getMessage());
}
$dosyaAdi = "veriler.txt";
try {
$dosya = fopen($dosyaAdi, "r");
while (!feof($dosya)) {
$satir = fgets($dosya);
// Satırdaki boşlukları temizle
$satir = trim($satir);
if (!empty($satir)) {
// Satırdaki %0A gibi karakterleri temizle
$satir = urldecode($satir);
$stmt = $pdo->prepare("INSERT INTO makale (adi) VALUES (:deger)");
$stmt->bindParam(':deger', $satir);
$stmt->execute();
}
}
fclose($dosya);
echo "Eklendi";
} catch (Exception $e) {
echo "Eklenmiyor: " . $e->getMessage();
}
?>