Ne olursa olsun, mutlak veya göreceli sayfa PHP perde arkasında varibles gönderme?

1 Cevap php

Nasıl ben buradan ne sayfasına onları göndermeden ve nasıl ben bu değişkenler aynı anda birkaç sayfaya gönderebilir?

//catched those variables within the same page
$event = $_POST['event'];
$when = $_POST['eventdate'];
$where = $_POST['place'];
$name = $_POST['name'];
$tel = $_POST['tel'];
$email = $_POST['email'];
send $event, $when, $where, ... to("whateverurl1");//not the way

1 Cevap

Bir URL'ye veri ilanı bir PHP HTTP istekleri göndermek için izin verir curl extension ile yapılabilir.

Senin durumunda, böyle bir şey hile yapabilir:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
    'event' => $event, 
    'when' => $when, 
    // ... more here
));
$returned = curl_exec($ch);
curl_close($ch);

Detaylı bilgi için, curl_setopt curl_exec , and for more options (there are a lot of possible options !), bkz manuel sayfasına bir göz atmak isteyebilirsiniz.


Here, the most important ones are :

  • CURLOPT_URL: Eğer veri göndermek istediğiniz URL'yi belirtmek için
  • CURLOPT_POST: Eğer bir HTTP POST isteği göndermek istediğiniz gibi - varsayılan olan GET değil
  • CURLOPT_POSTFIELDS: Göndermek istediğiniz verileri belirtmek için


But note this will not send several queries in parallel -- maybe curl_multi_exec and the other curl_multi_* functions could help, there...