2

Does anyone knows How to bounce (RePost, exactly the same way) an array (datas) previously posted to my page ?

Here is how i do by now, guess it's not the best way :

Received datas

$_datas = $_REQUEST;

and how i rePost ?

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_URL, 'http://website.com/new_script.php');
 curl_setopt($ch, CURLOPT_POSTFIELDS, $_datas);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 $result = curl_exec($ch);

Anyone has an idea ? Please ;)

Thierry
  • 43
  • 2

1 Answers1

0

If you want to re-post data which comes in GET and POST, your code almost complete. Just need to add curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

So, code will be like this

$_datas = $_REQUEST;
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL, 'http://website.com/new_script.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, $_datas);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result     = curl_exec($ch);
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
Dolly Aswin
  • 2,684
  • 1
  • 20
  • 23