Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    php pass variables to another php

    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.

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,387
    Thanks
    8
    Thanked 1,077 Times in 1,068 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •