View Full Version : php pass variables to another php

05-07-2009, 07:21 PM
Well basically here is what I have so far. I have a form where a user inputs things. Then It sends it to a php script which does some work with it. What I want it to do is have a user send enter the stuff in the form, it then gets submited to my script, and my script passes the variables onto another website.

Now I already have the variables sent via post to my script. I need them to be sent on to the other website using post too. I have no control over the other website. I just know what variables i have to send. And i do not want the user to have to enter his info all over again just so it gets sent to the other site.

So how can i pass along post variables?

I asked at another forum and they said i was trying to do something fishy. well im not because:

Its a guys website at my school. He just wants an extra layer of security to where u have to go through my site to get to his. Kinda weird i know but he already has it setup on his side and is reluctant to change it. So I already have everything setup accept this. cookies and all that.

05-07-2009, 08:39 PM
You will have to send them using $_GET ... so you attach the variables to his URL,
and he then has to read them. He cannot read your cookies or sessions and even
with $_GET and $_POST, he will need to be able to accept your variables ... so he
defines the variables that you send?

You mentioned using POST only, but forms are really the only way. You would have
to redisplay the form (with the variables in place) and ask the user to submit again
to POST to his site. Otherwise, use fsockopen() to connect with the server and construct the HTTP request yourself ... which is pretty advanced (I don't know much about it).

Who really wants the data, you or him?
Why do both of you need the form data?