A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: PHP - send POST variables from one script to another without a form

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    486

    PHP - send POST variables from one script to another without a form

    how can i send variables from one script to another without having to place them in the url string?

    i really don't want to have to save variables to the server and then send data in the url string about where they are kept

    i want a script to be able to receive some data (either GET or POST) from a 3rd party website and then i can redirect to a new page depending on what is received. along with the redirecting i need to be able to pass certain variables

    could i possible just store session variables? are these kept on the client or server computer?

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    of course you can call a script on a foreign server from a script on your server.
    If the foreign server works with GET variables, usually all you need to do is
    fopen("http://www.google.com/?q=proxy", "r");
    and then handle received data
    If the foreign server wants POST variables, or even wants to create its own session, the process is somewhat more complex (but often the CURL package can be used from php). If this is not an option, you would use something like
    $fp = fsockopen("www.site.com", 80);
    fputs($fp, "POST /script.php HTTP/1.0
    Host: www.site.com
    Content-Length: 7

    q=proxy");
    and read the result. Note that in this case the result is preceded with a http header as well

    Musicman

  3. #3
    Sergei A. Kornev Maestro_cK's Avatar
    Join Date
    Jul 2002
    Location
    Saint Petersburg
    Posts
    155
    Session variables is strored in temprory files on server.

  4. #4
    Senior Member
    Join Date
    Jul 2000
    Location
    Sydney, Australia
    Posts
    486
    thanks

    i know that you can call it with get variables easily i just wasn't sure how to pass post variables

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center