php uzaktan dosya güncelleme entegresi nasıl yaparım?
2
●122
- 27-09-2023, 16:53:07Kimlik doğrulama veya yönetimden onay bekliyor.file-controller.php tarzı bir dosya oluşturun uzak sunucudan istek gönderin ama token kullanın başkalarıda gönderebilir örnek;
Eski dosyayı siliyor ve sizin girdiğiniz yeni dosyayı indiriyor
Uzak Sunucudaki Post Gönderen Dosya;
$formdegeri = array( 'token' => 'xsdfdsfvsd', 'dosya' => 'urunler.php' ); $postVeri = http_build_query($form_degerleri); $ayarlar = array('http' => array('method' => 'POST', 'header' => 'Content-Type: application/x-www-form-urlencoded', 'content' => $postVeri)); $formAyar = stream_context_create($ayarlar); $url = 'https://www.example.com/file-controller.php'; Dosyaların Değiştirileceği Site if (!empty($_POST['token']) && !empty($_POST['dosya'])) { if ($_POST['token'] == "xsdfdsfvsd ") { unlink($_POST['dosya']); $url = "https://www.uzaksunucuadresi.com/" . $_POST['dosya']; $file_name = basename($url); if (file_put_contents($file_name, file_get_contents($url))) { echo "Dosya başarıyla indirildi."; } else { echo "Dosya indirme başarısız."; } } }