Redirecting on the server side?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • laredotornado@zipmail.com

    #1

    Redirecting on the server side?

    Hello,

    I'm using PHP 4.4.4. After processing some data, I'd like to redirect
    to another page for further data processing. The way I'm redirecting
    right now is

    header("Locatio n: next_page.php") ;

    However, as you know this causes information to be sent to the client
    before the next page is contacted. Is there a way I can go to
    "next_page. php" without contacting the client?

    Thanks, - Dave

  • Tyrone Slothrop

    #2
    Re: Redirecting on the server side?

    On 9 Oct 2006 06:23:57 -0700, "laredotornado@ zipmail.com"
    <laredotornado@ zipmail.comwrot e:
    >Hello,
    >
    >I'm using PHP 4.4.4. After processing some data, I'd like to redirect
    >to another page for further data processing. The way I'm redirecting
    >right now is
    >
    >header("Locati on: next_page.php") ;
    >
    >However, as you know this causes information to be sent to the client
    >before the next page is contacted. Is there a way I can go to
    >"next_page.php " without contacting the client?
    >
    >Thanks, - Dave
    You can use include() to display the contents of the page. Depending
    on what you are doing on the page that is processing the data, a
    flush() and ob_flush() may be required before the include call.

    Comment

    • laredotornado@zipmail.com

      #3
      Re: Redirecting on the server side?

      Thanks for your reply. The page I want to invoke accesses data from
      $_REQUEST. So I wanted to call the page in this fashion

      next_page.php?v ar1=val1&var2=v al2&var3=val3

      "includes" don't take query strings, if I remember correctly. Any way
      to invoke the above?

      Thanks, -

      Tyrone Slothrop wrote:
      On 9 Oct 2006 06:23:57 -0700, "laredotornado@ zipmail.com"
      <laredotornado@ zipmail.comwrot e:
      >
      Hello,

      I'm using PHP 4.4.4. After processing some data, I'd like to redirect
      to another page for further data processing. The way I'm redirecting
      right now is

      header("Locatio n: next_page.php") ;

      However, as you know this causes information to be sent to the client
      before the next page is contacted. Is there a way I can go to
      "next_page. php" without contacting the client?

      Thanks, - Dave
      >
      You can use include() to display the contents of the page. Depending
      on what you are doing on the page that is processing the data, a
      flush() and ob_flush() may be required before the include call.

      Comment

      • Todd

        #4
        Re: Redirecting on the server side?

        I think what Tyrone was getting at was that you could process the data
        on your first page. Then, once that is done you can include your second
        page where all of the query string variables from the first page would
        be available to the include page.

        You could, with a little process in the first page, call different
        include pages based on what was sent to the first page.

        REGARDS
        -------------
        laredotornado@z ipmail.com wrote:
        Thanks for your reply. The page I want to invoke accesses data from
        $_REQUEST. So I wanted to call the page in this fashion
        >
        next_page.php?v ar1=val1&var2=v al2&var3=val3
        >
        "includes" don't take query strings, if I remember correctly. Any way
        to invoke the above?
        >
        Thanks, -
        >
        Tyrone Slothrop wrote:
        >On 9 Oct 2006 06:23:57 -0700, "laredotornado@ zipmail.com"
        ><laredotornado @zipmail.comwro te:
        >>
        >>Hello,
        >>>
        >>I'm using PHP 4.4.4. After processing some data, I'd like to redirect
        >>to another page for further data processing. The way I'm redirecting
        >>right now is
        >>>
        >>header("Locat ion: next_page.php") ;
        >>>
        >>However, as you know this causes information to be sent to the client
        >>before the next page is contacted. Is there a way I can go to
        >>"next_page.ph p" without contacting the client?
        >>>
        >>Thanks, - Dave
        >You can use include() to display the contents of the page. Depending
        >on what you are doing on the page that is processing the data, a
        >flush() and ob_flush() may be required before the include call.
        >

        Comment

        • Chuck Anderson

          #5
          Re: Redirecting on the server side?

          laredotornado@z ipmail.com wrote:
          Thanks for your reply. The page I want to invoke accesses data from
          $_REQUEST. So I wanted to call the page in this fashion
          >
          next_page.php?v ar1=val1&var2=v al2&var3=val3
          >
          "includes" don't take query strings, if I remember correctly. Any way
          to invoke the above?
          >
          You don't need to. Those vars are already within the scope of the
          included file.

          --
          *************** **************
          Chuck Anderson • Boulder, CO

          *************** **************

          Comment

          • Kimmo Laine

            #6
            Re: Redirecting on the server side?

            <laredotornado@ zipmail.comwrot e in message
            news:1160408690 .313328.253560@ k70g2000cwa.goo glegroups.com.. .
            Thanks for your reply. The page I want to invoke accesses data from
            $_REQUEST. So I wanted to call the page in this fashion
            >
            next_page.php?v ar1=val1&var2=v al2&var3=val3
            >
            "includes" don't take query strings, if I remember correctly. Any way
            to invoke the above?

            You could use full path:

            <?php

            include('http://www.your.domain/next_page.php?f oo=bar');
            exit();

            ?>

            But as other people have already stated, your varables are available in the
            included page just as well.

            --
            "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
            http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
            spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


            Comment

            • Pedro Graca

              #7
              Re: Redirecting on the server side?

              Kimmo Laine wrote:
              <?php
              >
              include('http://www.your.domain/next_page.php?f oo=bar');
              Unless next_page.php generates PHP, the script with this include will
              only get HTML.
              exit();
              >
              ?>
              next_page.php

              <?php
              if (isset($_GET['foo'])) {
              echo '<?php echo $_GET[\'foo\']; ?>';
              } else {
              echo '<?php echo \'Not available\'; ?>';
              }

              --
              File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

              Comment

              • Kimmo Laine

                #8
                Re: Redirecting on the server side?

                "Pedro Graca" <hexkid@dodgeit .comwrote in message
                news:slrneinc74 .4mo.hexkid@ID-203069.user.ind ividual.net...
                Kimmo Laine wrote:
                ><?php
                >>
                >include('htt p://www.your.domain/next_page.php?f oo=bar');
                >
                Unless next_page.php generates PHP, the script with this include will
                only get HTML.
                Since the object was to only invisbly redirect to the page, it doesn't
                matter. A real issue would be that in this case cookie and session data
                would not be available in next_page.php since it's the server fetching the
                page, not the client.

                --
                "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
                http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
                spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


                Comment

                Working...