Redirecting user via post

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brendan

    Redirecting user via post

    Hi

    I just made a script that gets a bunch of login info and I've come across a
    hurdle that I failed to think about it.. and now think I may have wasted my
    time...

    The login info I retreive needs to be POSTed to another site. Everything is
    beautiful, except now I don't know how to go about it..

    I could use Location: URL but I have to chuck on the login info in the URL
    which would then be visible to the naked eye.

    Is there a way to POST it.. ? Been a while since I messed with web stuff so
    any help appreciated.

    Please help.

    TIA


  • Chung Leong

    #2
    Re: Redirecting user via post

    "Brendan" <bjg@adsl.onnet > wrote in message
    news:40894965$1 @duster.adelaid e.on.net...[color=blue]
    > Hi
    >
    > I just made a script that gets a bunch of login info and I've come across[/color]
    a[color=blue]
    > hurdle that I failed to think about it.. and now think I may have wasted[/color]
    my[color=blue]
    > time...
    >
    > The login info I retreive needs to be POSTed to another site. Everything[/color]
    is[color=blue]
    > beautiful, except now I don't know how to go about it..
    >
    > I could use Location: URL but I have to chuck on the login info in the URL
    > which would then be visible to the naked eye.
    >
    > Is there a way to POST it.. ? Been a while since I messed with web stuff[/color]
    so[color=blue]
    > any help appreciated.[/color]

    Use the HTTP status code 307:

    header("HTTP/1.0 307 Temporary Redirect");
    header("Locatio n: http://www.example.com/");

    When the incoming request is a POST, the browser post to the redirected page
    as well. Note that in some non-standard browsers a warning would appear.


    Comment

    • Daniel Tryba

      #3
      Re: Redirecting user via post

      Chung Leong <chernyshevsky@ hotmail.com> wrote:[color=blue][color=green]
      >> The login info I retreive needs to be POSTed to another site. Everything[/color]
      > is[color=green]
      >> beautiful, except now I don't know how to go about it..
      >>
      >> I could use Location: URL but I have to chuck on the login info in the URL
      >> which would then be visible to the naked eye.
      >>
      >> Is there a way to POST it.. ? Been a while since I messed with web stuff[/color]
      > so[color=green]
      >> any help appreciated.[/color]
      >
      > Use the HTTP status code 307:
      >
      > header("HTTP/1.0 307 Temporary Redirect");
      > header("Locatio n: http://www.example.com/");
      >
      > When the incoming request is a POST, the browser post to the redirected page
      > as well. Note that in some non-standard browsers a warning would appear.[/color]

      My guess is this is not what the OP acutally wants. Unless he wants to
      redirect the browser to the other site (in that case pointing the action
      directly to the site might be easier).

      My guess is that he wants to do the post from within his own php, in
      that case he could take a look at curl, snoopy
      (http://sourceforge.net/projects/snoopy/) or an code snipper I once
      posted here
      (http://groups.google.com/groups?selm...%40news.tue.nl)

      --

      Daniel Tryba

      Comment

      • Brendan

        #4
        Re: Redirecting user via post

        "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
        news:nbWdnQa8uv t8KhTdRVn-uw@comcast.com. ..[color=blue]
        > "Brendan" <bjg@adsl.onnet > wrote in message
        > news:40894965$1 @duster.adelaid e.on.net...[color=green]
        > > Hi
        > >
        > > I just made a script that gets a bunch of login info and I've come[/color][/color]
        across[color=blue]
        > a[color=green]
        > > hurdle that I failed to think about it.. and now think I may have wasted[/color]
        > my[color=green]
        > > time...
        > >
        > > The login info I retreive needs to be POSTed to another site. Everything[/color]
        > is[color=green]
        > > beautiful, except now I don't know how to go about it..
        > >
        > > I could use Location: URL but I have to chuck on the login info in the[/color][/color]
        URL[color=blue][color=green]
        > > which would then be visible to the naked eye.
        > >
        > > Is there a way to POST it.. ? Been a while since I messed with web stuff[/color]
        > so[color=green]
        > > any help appreciated.[/color]
        >
        > Use the HTTP status code 307:
        >
        > header("HTTP/1.0 307 Temporary Redirect");
        > header("Locatio n: http://www.example.com/");
        >
        > When the incoming request is a POST, the browser post to the redirected[/color]
        page[color=blue]
        > as well. Note that in some non-standard browsers a warning would appear.[/color]

        Excellent! That works great, thanks.


        Comment

        • Brendan

          #5
          Re: Redirecting user via post

          "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
          news:c6cjpj$5sn $2@news.tue.nl. ..[color=blue]
          > Chung Leong <chernyshevsky@ hotmail.com> wrote:[color=green][color=darkred]
          > >> The login info I retreive needs to be POSTed to another site.[/color][/color][/color]
          Everything[color=blue][color=green]
          > > is[color=darkred]
          > >> beautiful, except now I don't know how to go about it..
          > >>
          > >> I could use Location: URL but I have to chuck on the login info in the[/color][/color][/color]
          URL[color=blue][color=green][color=darkred]
          > >> which would then be visible to the naked eye.
          > >>
          > >> Is there a way to POST it.. ? Been a while since I messed with web[/color][/color][/color]
          stuff[color=blue][color=green]
          > > so[color=darkred]
          > >> any help appreciated.[/color]
          > >
          > > Use the HTTP status code 307:
          > >
          > > header("HTTP/1.0 307 Temporary Redirect");
          > > header("Locatio n: http://www.example.com/");
          > >
          > > When the incoming request is a POST, the browser post to the redirected[/color][/color]
          page[color=blue][color=green]
          > > as well. Note that in some non-standard browsers a warning would appear.[/color]
          >
          > My guess is this is not what the OP acutally wants. Unless he wants to
          > redirect the browser to the other site (in that case pointing the action
          > directly to the site might be easier).[/color]

          It's a bit more than that. I need to check a radio option that the user
          selects, and then the form data they entered gets posted to the site
          depending on what radio option they selected.
          [color=blue]
          > My guess is that he wants to do the post from within his own php, in
          > that case he could take a look at curl, snoopy
          > (http://sourceforge.net/projects/snoopy/) or an code snipper I once
          > posted here
          > (http://groups.google.com/groups?selm...%40news.tue.nl)[/color]

          Thanks for your help.


          Comment

          • Chung Leong

            #6
            Re: Redirecting user via post

            "Daniel Tryba" <news_comp.lang .php@canopus.nl > wrote in message
            news:c6cjpj$5sn $2@news.tue.nl. ..[color=blue]
            >
            > My guess is this is not what the OP acutally wants. Unless he wants to
            > redirect the browser to the other site (in that case pointing the action
            > directly to the site might be easier).
            >
            > My guess is that he wants to do the post from within his own php, in
            > that case he could take a look at curl, snoopy
            > (http://sourceforge.net/projects/snoopy/) or an code snipper I once
            > posted here
            > (http://groups.google.com/groups?selm...%40news.tue.nl)[/color]

            But then the user doesn't get redirected to the other site. If you need to
            alter the form data before the redirection occurs, I think the only way is
            to generate a form with the altered data in hidden fields, then submit the
            form automatically using Javascript.


            Comment

            Working...