Page 1 of 1

Sending POST data from one PHP file to another

Posted: Sat Jun 24, 2006 10:59 am
by Gen-ik
Hi, guys.


Is it possible to send POST data from one PHP file to another?

Code: Select all

<?php

header("content-type:application/x-www-form-urlencoded");

// add variables

header("location:target.php");

?>
If it is not possible then no problem. If it is possible could someone please supply a little example of how I would send the variable data. :)


Thanks,
Si ++

Posted: Sat Jun 24, 2006 5:45 pm
by feyd
Through redirection, no. Through cURL, yes. However, if the end file is on your server, why not pass it through sessions?

Posted: Sat Jun 24, 2006 6:45 pm
by Gen-ik
feyd wrote:Through redirection, no. Through cURL, yes. However, if the end file is on your server, why not pass it through sessions?
Good point. :D
Totally obvious thing to do really.

Thanks, mate.

Posted: Sat Jun 24, 2006 7:41 pm
by phpCCore Brad
I actually have a question along the same lines... I was working on a search engine optimizer which takes forwards anything from a specific directory to a php script. With .htaccess. However since the .htaccess doc is not php is there a way to transfer the request vars to the php script using htaccess?