'; $query = mysqli_query($conn,"SELECT p.*, c.name as category FROM products p LEFT JOIN categories c ON p.category_id=c.id WHERE p.status='1' AND p.stock > 0"); while($row = mysqli_fetch_assoc($query)){ $id = $row['id']; $name = htmlspecialchars($row['title']); $price = $row['price']; $brand = htmlspecialchars($row['brand']); $category = htmlspecialchars($row['category']); $image = "https://lavasemkhangi.ir/uploads/".$row['image']; $url = "https://lavasemkhangi.ir/product/".$row['slug']; $xml .= " $id $name $price $brand $category $url $image instock "; } $xml .= ""; // ذخیره فید روی سرور (کش محلی) $cache_file = __DIR__ . '/torob-feed-real.xml'; file_put_contents($cache_file, $xml); // ارسال فید به ترب خودکار $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $torob_api); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, ['feed_file' => new CURLFile($cache_file)]); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); // گزارش آپدیت file_put_contents(__DIR__ . '/torob-log.txt', date('Y-m-d H:i:s')." - Feed sent. Response: ".$response."\n", FILE_APPEND); echo "Feed sent to Torob successfully!"; ?>
جستجو در محصولات
کالایی در این صفحه موجود نیست
    پروفایلسبد خریددسته‌بندیخانه