Redirect with POST

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ania.malicka85@gmail.com

    Redirect with POST

    Hello,

    I am playing with automatic redirection with PHP. As with GET is
    fairly simple (<meta http-equiv="refresh" content="3;url= "http://
    www.google.com/search?q=php">

    how can I do similar thing with POST (lets assume that I want to add q
    = php to post variables). How can I do this?

    regards, Ann
  • macca

    #2
    Re: Redirect with POST

    You cant.

    If you want to pass POST variables to a page you either have to post
    them, as in submit a form, or use cURL through PHP.

    Comment

    • ania.malicka85@gmail.com

      #3
      Re: Redirect with POST

      Hello,
      If you want to pass POST variables to a page you either have to post
      them, as in submit a form, or use cURL through PHP.
      Thank you! I tried both methods, but:
      - when I used html form, I must click a button to proceed (and I want
      automatic redirection after 5 seconds). Can I simulate somehow submit
      click on this form?

      - when I used cURL functions (e.g. saved in file redirect.php) and
      want to pass POST variables to show.php it works okay (to delay I used
      sleep(5), but in the browser the original url (redirect.php) is saved
      and not changed to show.php. Any idea how to make that change?

      Regards, Ann

      Comment

      • The Natural Philosopher

        #4
        Re: Redirect with POST

        ania.malicka85@ gmail.com wrote:
        Hello,
        >
        >If you want to pass POST variables to a page you either have to post
        >them, as in submit a form, or use cURL through PHP.
        >
        Thank you! I tried both methods, but:
        - when I used html form, I must click a button to proceed (and I want
        automatic redirection after 5 seconds). Can I simulate somehow submit
        click on this form?
        >
        Yes. Javascript can execute a submit operation. Ni odea how to time it tho.

        - when I used cURL functions (e.g. saved in file redirect.php) and
        want to pass POST variables to show.php it works okay (to delay I used
        sleep(5), but in the browser the original url (redirect.php) is saved
        and not changed to show.php. Any idea how to make that change?
        >
        Never used CURL - pass. In javascript the problem is soluble p[retty simply.
        Regards, Ann

        Comment

        • Ulf Kadner

          #5
          Re: Redirect with POST

          ania.malicka85@ gmail.com wrote:
          I am playing with automatic redirection with PHP. As with GET is
          fairly simple (<meta http-equiv="refresh" content="3;url= "http://
          www.google.com/search?q=php">
          >
          how can I do similar thing with POST (lets assume that I want to add q
          = php to post variables). How can I do this?
          You have to save youre submited Post-Data into the Session. After
          Redirection you can access it there.

          So long, Ulf

          Comment

          • Michael Fesser

            #6
            Re: Redirect with POST

            ..oO(ania.malic ka85@gmail.com)
            >I am playing with automatic redirection with PHP. As with GET is
            >fairly simple (<meta http-equiv="refresh" content="3;url= "http://
            >www.google.c om/search?q=php">
            This is not a redirect. Proper redirects are done on HTTP level with
            appropriate status codes. The above is an abuse of the meta element and
            a good way to break the browser's back button. Don't do that.
            >how can I do similar thing with POST (lets assume that I want to add q
            >= php to post variables). How can I do this?
            HTTP doesn't allow this. Use a session to pass the data to another page
            or, if it's a completely different site, have the user invoking the
            submit by pressing a submit button.

            Micha

            Comment

            Working...