Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Wysyłka na URL $_POST
Randallmaster
post
Post #1





Grupa: Zarejestrowani
Postów: 677
Pomógł: 11
Dołączył: 18.11.2009

Ostrzeżenie: (0%)
-----


Witam,

Potrzebuje wysłać zmiene w $_POST:

$_POST['name']
$_POST['surname']

na adres: http://docelowyadres.pl/

nie może to być w formularzu<form>.

Próbowałem tak:

$postdata = http_build_query(array('NAME' => $_POST['name'], 'SURNAME' => $_POST['surname']));
$context = stream_context_create($postdata);
fopen('http://docelowyadres.pl/', 'r', false, $context);

niestety wyskakują błędy

Warning: stream_context_create() expects parameter 1 to be array, string given in ...

Warning: fopen() expects parameter 4 to be resource, string given in ...
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
pabito
post
Post #2





Grupa: Zarejestrowani
Postów: 77
Pomógł: 4
Dołączył: 14.05.2013

Ostrzeżenie: (0%)
-----


a próbowałeś wysłać dane za pomocą CURL ?

  1. <?php
  2. //
  3. // A very simple PHP example that sends a HTTP POST to a remote site
  4. //
  5.  
  6. $ch = curl_init();
  7.  
  8. curl_setopt($ch, CURLOPT_URL,"http://www.mysite.com/tester.phtml");
  9. curl_setopt($ch, CURLOPT_POST, 1);
  10. curl_setopt($ch, CURLOPT_POSTFIELDS,
  11. "postvar1=value1&postvar2=value2&postvar3=value3");
  12.  
  13. curl_exec ($ch);
  14. curl_close ($ch);
  15. ?>


Ten post edytował pabito 6.06.2013, 11:18:49
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 30.12.2025 - 16:49