Need some help on header refresh...

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

    Need some help on header refresh...

    Harlow... i need some help on these... im actually trying to do a page
    using php... the function is to receive certain parameters from a 3rd
    party provider... and i need to redirect my page to another page after
    certain validation. it's ok when i use the url to do the testing...
    the validation part works fine... scenario as below:

    if situation a, echo abc

    if situation b, echo abc then refresh to another page.

    the problem is after the 3rd party call my page the refresh doesnt
    work... after doing some amendments, it redirects to another page but
    doesnt echo abc... so any other way to redirect the page??? tried
    output buffer start and flush but still couldn.... SOS...

    Regards,
    Justin

  • Jerry Stuckle

    #2
    Re: Need some help on header refresh...

    Justin wrote:
    Harlow... i need some help on these... im actually trying to do a page
    using php... the function is to receive certain parameters from a 3rd
    party provider... and i need to redirect my page to another page after
    certain validation. it's ok when i use the url to do the testing...
    the validation part works fine... scenario as below:
    >
    if situation a, echo abc
    >
    if situation b, echo abc then refresh to another page.
    >
    the problem is after the 3rd party call my page the refresh doesnt
    work... after doing some amendments, it redirects to another page but
    doesnt echo abc... so any other way to redirect the page??? tried
    output buffer start and flush but still couldn.... SOS...
    >
    Regards,
    Justin
    >
    You can use header() calls to redirect, but it is incompatible with
    echo(). You can't send ANY output to the browser before a header() call.

    But if you're redirecting, any output you send would not be displayed
    anyway - so why bother sending it?


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Justin

      #3
      Re: Need some help on header refresh...

      On Mar 3, 11:29 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      Justin wrote:
      Harlow... i need some help on these... im actually trying to do a page
      using php... the function is to receive certain parameters from a 3rd
      party provider... and i need to redirect my page to another page after
      certain validation. it's ok when i use the url to do the testing...
      the validation part works fine... scenario as below:
      >
      if situation a, echo abc
      >
      if situation b, echo abc then refresh to another page.
      >
      the problem is after the 3rd party call my page the refresh doesnt
      work... after doing some amendments, it redirects to another page but
      doesnt echo abc... so any other way to redirect the page??? tried
      output buffer start and flush but still couldn.... SOS...
      >
      Regards,
      Justin
      >
      You can use header() calls to redirect, but it is incompatible with
      echo(). You can't send ANY output to the browser before a header() call.
      >
      But if you're redirecting, any output you send would not be displayed
      anyway - so why bother sending it?
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===
      er... the requirement from my 3rd party provider is that i have to
      reply -1 once receive the parameters from them.. so i put echo -1. is
      there any other way to send instead of echo? the redirecting part is
      something i wan to add on... it's not in the API they provided...

      Comment

      • Jerry Stuckle

        #4
        Re: Need some help on header refresh...

        Justin wrote:
        On Mar 3, 11:29 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >Justin wrote:
        >>Harlow... i need some help on these... im actually trying to do a page
        >>using php... the function is to receive certain parameters from a 3rd
        >>party provider... and i need to redirect my page to another page after
        >>certain validation. it's ok when i use the url to do the testing...
        >>the validation part works fine... scenario as below:
        >>if situation a, echo abc
        >>if situation b, echo abc then refresh to another page.
        >>the problem is after the 3rd party call my page the refresh doesnt
        >>work... after doing some amendments, it redirects to another page but
        >>doesnt echo abc... so any other way to redirect the page??? tried
        >>output buffer start and flush but still couldn.... SOS...
        >>Regards,
        >>Justin
        >You can use header() calls to redirect, but it is incompatible with
        >echo(). You can't send ANY output to the browser before a header() call.
        >>
        >But if you're redirecting, any output you send would not be displayed
        >anyway - so why bother sending it?
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        er... the requirement from my 3rd party provider is that i have to
        reply -1 once receive the parameters from them.. so i put echo -1. is
        there any other way to send instead of echo? the redirecting part is
        something i wan to add on... it's not in the API they provided...
        >
        OK, you have to respond with a -1. But once you send ANY output, you
        can't use a header() call.

        header() must be called before the headers are sent to the browser. And
        any output - even white space - will cause the headers to be sent. So
        you can either send a response or do the redirect. But the HTTP
        protocol (not PHP) won't let you do both.


        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • rob.brown@gmail.com

          #5
          Re: Need some help on header refresh...

          What about a meta refresh instead of the header() function?

          Comment

          • Jerry Stuckle

            #6
            Re: Need some help on header refresh...

            rob.brown@gmail .com wrote:
            What about a meta refresh instead of the header() function?
            >
            Does the third party browser understand meta refresh? I highly suspect
            it doesn't - most non-browsers don't.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            • Rik

              #7
              Re: Need some help on header refresh...

              Jerry Stuckle <jstucklex@attg lobal.netwrote:
              > er... the requirement from my 3rd party provider is that i have to
              >reply -1 once receive the parameters from them.. so i put echo -1. is
              >there any other way to send instead of echo? the redirecting part is
              >something i wan to add on... it's not in the API they provided...
              >>
              >
              OK, you have to respond with a -1. But once you send ANY output, you
              can't use a header() call.
              >
              header() must be called before the headers are sent to the browser. And
              any output - even white space - will cause the headers to be sent. So
              you can either send a response or do the redirect. But the HTTP
              protocol (not PHP) won't let you do both.
              Allthough...
              You can have a header redirect & output, I'm a bit fuzzy on wether this is
              actually allowed with the HTTP protocol, but for instance, I can disable
              automatic redirects (yes, also header redirects) in Opera, and I'll see
              the content that comes next. So I see no practical reason why you cannot
              send a redirect header & some content, as long as you set the header first
              in PHP. There is a reason it's so often advised to die()/exit() after a
              redirect statement.
              --
              Rik Wasmus

              Comment

              • Justin

                #8
                Re: Need some help on header refresh...

                Dear Jerry,
                You fully understand the situation im in right now... Mayb i will
                elaborate more on this.
                My application is to correspond with a mobile provider gateway
                using HTTP calls. And meta refresh is not allowed.
                Initially i din have to do any redirect as the process is actually
                very simple. Once a mobile user register the service with their mobile
                phone, the provider will call/send in the parameters to my
                page(assuming receive.php). And upon receiving the parameters, i need
                to echo "-1"; to the provider so a standard message will be sent out
                to the registrant. The -1 is a requirement from my provider. So they
                only recognized this. (according to their API). The reason why i have
                to redirect is because some registrant might not be providing enough
                information, so i did a strlen($sms) on the sms receive to see how
                many characters is there and therefore determine whehter the info is
                complete or not... So there are 2 situations, complete info and
                incomplete info. Both i will reply -1 for them to receive the standard
                sms but only those with incomplete info will receive a customized msg
                from my side. That's the thing. If i put on the same page, those with
                incomplete msg cant receive anything ask the provider only recognized
                -1 for the registration process.... Thanx.

                On Mar 4, 7:21 am, Rik <luiheidsgoe... @hotmail.comwro te:
                Jerry Stuckle <jstuck...@attg lobal.netwrote:
                er... the requirement from my 3rd party provider is that i have to
                reply -1 once receive the parameters from them.. so i put echo -1. is
                there any other way to send instead of echo? the redirecting part is
                something i wan to add on... it's not in the API they provided...
                >
                OK, you have to respond with a -1. But once you send ANY output, you
                can't use a header() call.
                >
                header() must be called before the headers are sent to the browser. And
                any output - even white space - will cause the headers to be sent. So
                you can either send a response or do the redirect. But the HTTP
                protocol (not PHP) won't let you do both.
                >
                Allthough...
                You can have a header redirect & output, I'm a bit fuzzy on wether this is
                actually allowed with the HTTP protocol, but for instance, I can disable
                automatic redirects (yes, also header redirects) in Opera, and I'll see
                the content that comes next. So I see no practical reason why you cannot
                send a redirect header & some content, as long as you set the header first
                in PHP. There is a reason it's so often advised to die()/exit() after a
                redirect statement.
                --
                Rik Wasmus

                Comment

                • Jerry Stuckle

                  #9
                  Re: Need some help on header refresh...

                  Justin wrote:
                  >Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  >>> er... the requirement from my 3rd party provider is that i have to
                  >>>reply -1 once receive the parameters from them.. so i put echo -1. is
                  >>>there any other way to send instead of echo? the redirecting part is
                  >>>something i wan to add on... it's not in the API they provided...
                  >>OK, you have to respond with a -1. But once you send ANY output, you
                  >>can't use a header() call.
                  >>header() must be called before the headers are sent to the browser. And
                  >>any output - even white space - will cause the headers to be sent. So
                  >>you can either send a response or do the redirect. But the HTTP
                  >>protocol (not PHP) won't let you do both.
                  >Allthough...
                  >You can have a header redirect & output, I'm a bit fuzzy on wether this is
                  >actually allowed with the HTTP protocol, but for instance, I can disable
                  >automatic redirects (yes, also header redirects) in Opera, and I'll see
                  >the content that comes next. So I see no practical reason why you cannot
                  >send a redirect header & some content, as long as you set the header first
                  >in PHP. There is a reason it's so often advised to die()/exit() after a
                  >redirect statement.
                  >--
                  >Rik Wasmus
                  >
                  >
                  Dear Jerry,
                  You fully understand the situation im in right now... Mayb i will
                  elaborate more on this.
                  My application is to correspond with a mobile provider gateway
                  using HTTP calls. And meta refresh is not allowed.
                  Initially i din have to do any redirect as the process is actually
                  very simple. Once a mobile user register the service with their mobile
                  phone, the provider will call/send in the parameters to my
                  page(assuming receive.php). And upon receiving the parameters, i need
                  to echo "-1"; to the provider so a standard message will be sent out
                  to the registrant. The -1 is a requirement from my provider. So they
                  only recognized this. (according to their API). The reason why i have
                  to redirect is because some registrant might not be providing enough
                  information, so i did a strlen($sms) on the sms receive to see how
                  many characters is there and therefore determine whehter the info is
                  complete or not... So there are 2 situations, complete info and
                  incomplete info. Both i will reply -1 for them to receive the standard
                  sms but only those with incomplete info will receive a customized msg
                  from my side. That's the thing. If i put on the same page, those with
                  incomplete msg cant receive anything ask the provider only recognized
                  -1 for the registration process.... Thanx.
                  >
                  On Mar 4, 7:21 am, Rik <luiheidsgoe... @hotmail.comwro te:
                  (Top posting fixed)

                  OK, so the registrant is coming through a provider to register with you.
                  The provider sends you some information and you respond with "-1".
                  The provider then sends a standard message to the registrant.

                  But you can't redirect the registrant because they aren't talking to you
                  in the first place. They're talking to the provider.

                  So how do you send a customized message to them?

                  Additionally, the fact this is coming from a cell phone is *very
                  relevant* and new information. It makes a huge difference. Most cell
                  phones don't have all the "bells and whistles" of regular browsers.

                  P.S. Please don't top post. Thanks.

                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Justin

                    #10
                    Re: Need some help on header refresh...

                    Dear Jerry,
                    There's a API provided to us by the provider, with the parameters
                    required and process of sending. So the situation is like this. In
                    order to prevent ppl from abusing the use of mobile contents(spam,
                    unnecessary charges to mobile users), the local telcos strictly
                    required us(content provider) to follow their registration process. A
                    specific keyword must be provided to indicate the registration
                    process. Assuming REG ABC is my keyword for the registration. Now i
                    want my subscribers to send in "REG ABC NAME ID AGE LOCATION". the
                    string will be one of the parameter i receive(lets put it as SMS). So
                    the parameters will be the mobile numbers, time, date, sms and so on.
                    The thing is the provider only take REG ABC into consideration, so
                    any numbers which send in a text msg to their server with the prefix
                    REG ABC will be routed to us(will call my php page). And i need to
                    repy -1 to acknowledge the receipts. Then the whole process is done.
                    But the thing is some of my subscribers leave out some important info
                    such as age, location etc (which is important to me but not the
                    provider) thats why i wanna send a msg to them ask them to provide the
                    additional info. (that is when the problem occurs). As the provider
                    only recognize REG ABC and -1 as a whole process, they dun care
                    whether the subscribers send in full msg or not. my side will have to
                    do the verification ourselves. That's why when i receive a msg with
                    incomplete info, i need to send them the msg, and this process is done
                    by using another method in the API.
                    I tried setting up a cron job or running the page with browser,
                    everything works well, the extra msg will be sent out. but when use
                    mobile phone to register, the page doesnt refresh/redirect. So they
                    only receive the standard msg from the provider. The standard msg is a
                    must as it's the requirements from the telcos. So i need to reply -1
                    first then only proceed with my own verification.

                    It's really nice meeting you here and thanx for being so helpful.

                    Regards,
                    Justin

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: Need some help on header refresh...

                      Justin wrote:
                      Dear Jerry,
                      There's a API provided to us by the provider, with the parameters
                      required and process of sending. So the situation is like this. In
                      order to prevent ppl from abusing the use of mobile contents(spam,
                      unnecessary charges to mobile users), the local telcos strictly
                      required us(content provider) to follow their registration process. A
                      specific keyword must be provided to indicate the registration
                      process. Assuming REG ABC is my keyword for the registration. Now i
                      want my subscribers to send in "REG ABC NAME ID AGE LOCATION". the
                      string will be one of the parameter i receive(lets put it as SMS). So
                      the parameters will be the mobile numbers, time, date, sms and so on.
                      The thing is the provider only take REG ABC into consideration, so
                      any numbers which send in a text msg to their server with the prefix
                      REG ABC will be routed to us(will call my php page). And i need to
                      repy -1 to acknowledge the receipts. Then the whole process is done.
                      But the thing is some of my subscribers leave out some important info
                      such as age, location etc (which is important to me but not the
                      provider) thats why i wanna send a msg to them ask them to provide the
                      additional info. (that is when the problem occurs). As the provider
                      only recognize REG ABC and -1 as a whole process, they dun care
                      whether the subscribers send in full msg or not. my side will have to
                      do the verification ourselves. That's why when i receive a msg with
                      incomplete info, i need to send them the msg, and this process is done
                      by using another method in the API.
                      I tried setting up a cron job or running the page with browser,
                      everything works well, the extra msg will be sent out. but when use
                      mobile phone to register, the page doesnt refresh/redirect. So they
                      only receive the standard msg from the provider. The standard msg is a
                      must as it's the requirements from the telcos. So i need to reply -1
                      first then only proceed with my own verification.
                      >
                      It's really nice meeting you here and thanx for being so helpful.
                      >
                      Regards,
                      Justin
                      >
                      Hi, Justin,

                      Yes, it might work with a browser. But in the cell phone registration
                      process they aren't communicating with you - they're communicating with
                      their cell provider. And therein lies the problem.

                      When you respond, you're responding to the cellular provider. And you
                      can only send what they understand. Since you've indicated the only
                      thing they understand is a -1, that's all you can send. Anything else
                      will be kicked out by them.

                      When you test with the browser you don't have that intermediate step
                      (the cellular provider) so of course it works.

                      The only thing you can do is talk to the provider to see if there is an
                      extended interface you can use.

                      --
                      =============== ===
                      Remove the "x" from my email address
                      Jerry Stuckle
                      JDS Computer Training Corp.
                      jstucklex@attgl obal.net
                      =============== ===

                      Comment

                      • Justin

                        #12
                        Re: Need some help on header refresh...

                        Dear Jerry,
                        I found a solution... Since i couldn refresh the page, so i thought
                        off clearing the buffer, so i added ob_start() and ob_end_clean() in a
                        certain portion of the coding AND IT WORKSS!!!!!

                        Thanx anyway, great to meet u!!!

                        Regards,
                        Justin

                        Comment

                        • Rik

                          #13
                          Re: Need some help on header refresh...

                          Justin <justin@smsit.c om.mywrote:
                          Dear Jerry,
                          I found a solution... Since i couldn refresh the page, so i thought
                          off clearing the buffer, so i added ob_start() and ob_end_clean() in a
                          certain portion of the coding AND IT WORKSS!!!!!
                          You haven't solved the problem, you've just masked it. The placing of
                          those 2 commands should give you a clue where you're sending content,
                          search that and remove it.

                          Your solution is like moving the couch to hide the nasty stain in the
                          carpet: the stain is still there, your carpet is not as it should be, it
                          just seems that way for now.
                          --
                          Rik Wasmus
                          Posted on Usenet, not any forum you might see this in.
                          Ask Smart Questions: http://tinyurl.com/anel

                          Comment

                          • Justin

                            #14
                            Re: Need some help on header refresh...

                            Actually REFRESH is a solution but the OB is an alternative as the
                            provider only accept -1 output(compulso ry to reply -1, echo -1;), but
                            the sending additional message part doesnt require me to reply
                            anything upon receiving th parameters from the provider. So i just
                            need to "hide" the return parameters from the provider. Thanx.

                            Comment

                            • Jerry Stuckle

                              #15
                              Re: Need some help on header refresh...

                              Justin wrote:
                              Actually REFRESH is a solution but the OB is an alternative as the
                              provider only accept -1 output(compulso ry to reply -1, echo -1;), but
                              the sending additional message part doesnt require me to reply
                              anything upon receiving th parameters from the provider. So i just
                              need to "hide" the return parameters from the provider. Thanx.
                              >
                              Which means you're not actually sending the return parameters to the
                              provider.

                              Not good.

                              --
                              =============== ===
                              Remove the "x" from my email address
                              Jerry Stuckle
                              JDS Computer Training Corp.
                              jstucklex@attgl obal.net
                              =============== ===

                              Comment

                              Working...