|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Greetings on New Year
![]() We have a script, say layer.php, which uses HTTP_REQUEST package to authenticate a user to an existing application (viz., wordpress, mediawiki etc.) I would like on the following two fronts: 1. How do I return the , headers etc. from the layer (which are being sent from the application) to the browser? 2. How do I redirect browser from the layer.php to a page of the application. I was thinking that if I could find a way to send the headers and to the browser, I could also send a 302 status code, along with the , to redirect the user to a page of the app. -- Thanks and Regards Peeyush Gulati +91-9916304135 |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Jan 5, 2008 9:06 AM, peeyush gulati <peeyushgulati@gmail.com> wrote:
> Greetings on New Year ![]() To you, as well! > We have a script, say layer.php, which uses HTTP_REQUEST package to > authenticate a user to an existing application (viz., wordpress, > mediawiki etc.) > > I would like on the following two fronts: > > 1. How do I return the , headers etc. from the layer (which are > being sent from the application) to the browser? > 2. How do I redirect browser from the layer.php to a page of the application. > > > I was thinking that if I could find a way to send the headers and > to the browser, I could also send a 302 status code, along > with the , to redirect the user to a page of the app. When you create a in your script, it is automatically sent via the HTTP server to the client (browser). The same occurs with $_SESSION information, as the PHPSESSID is sent to the browser to track the session name. With regard to redirection, there are a lot of ways to do that, but the easiest is as follows: <? header("Location: somefile.php"); exit; ?> Just be sure to always exit; after using the header("Location: xxx"); to stop the current script from running, unless you have explicit reasons not to do so. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Also, supply an absolute URL when using header redirects.
On Jan 5, 2008 3:44 PM, Daniel Brown <parasane@gmail.com> wrote: > On Jan 5, 2008 9:06 AM, peeyush gulati <peeyushgulati@gmail.com> wrote: > > Greetings on New Year ![]() > > To you, as well! > > > We have a script, say layer.php, which uses HTTP_REQUEST package to > > authenticate a user to an existing application (viz., wordpress, > > mediawiki etc.) > > > > I would like on the following two fronts: > > > > 1. How do I return the , headers etc. from the layer (which are > > being sent from the application) to the browser? > > 2. How do I redirect browser from the layer.php to a page of the > application. > > > > > > I was thinking that if I could find a way to send the headers and > > to the browser, I could also send a 302 status code, along > > with the , to redirect the user to a page of the app. > > When you create a in your script, it is automatically sent > via the HTTP server to the client (browser). The same occurs with > $_SESSION information, as the PHPSESSID is sent to the browser > to track the session name. > > With regard to redirection, there are a lot of ways to do that, > but the easiest is as follows: > > <? > header("Location: somefile.php"); > exit; > ?> > > Just be sure to always exit; after using the header("Location: > xxx"); to stop the current script from running, unless you have > explicit reasons not to do so. > > > -- > Daniel P. Brown > [Phone Numbers Go Here!] > [They're Hidden From View!] > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Jan 5, 2008 10:59 AM, Dave Goodchild <buddhamagnet@gmail.com> wrote:
> Also, supply an absolute URL when using header redirects. That's not necessary, as far as I know. Relative redirections have always worked just fine. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
It's advisable as the page you will be redirected to will be relative to the
one the browser actually requested, so it's a good habit to get into. On Jan 5, 2008 4:05 PM, Daniel Brown <parasane@gmail.com> wrote: > On Jan 5, 2008 10:59 AM, Dave Goodchild <buddhamagnet@gmail.com> wrote: > > Also, supply an absolute URL when using header redirects. > > That's not necessary, as far as I know. Relative redirections > have always worked just fine. > > -- > Daniel P. Brown > [Phone Numbers Go Here!] > [They're Hidden From View!] > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On Jan 5, 2008 11:14 AM, peeyush gulati <peeyushgulati@gmail.com> wrote:
> Thank you for the reply > > But i am not asking for simple rediredtion. I am aware of the > (header:"Location:url"); > > From a layer i am sending a http_request to an existing application, now the > application will response back to the layer. > > My concern is how do i make the application response back to the browser > instead of the layer without changing the code of the application although > the request was sent from layer. > > This is what i am looking for. Is there some PECL package. Please keep your replies on-list for others to benefit. What you're asking to do is send a third-party response to the browser which never instantiates the call to the remote script in the first place. To my knowledge, it's not possible, which is a good thing. Otherwise anyone would be able to inject arbitrary responses (like a man-in-the-middle attack). -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Thank you will do that
Ok can i redirect the response to the browser from the layer after my layer has recieved the response from the application. On Jan 5, 2008 10:05 PM, Daniel Brown <parasane@gmail.com> wrote: > On Jan 5, 2008 11:14 AM, peeyush gulati <peeyushgulati@gmail.com> wrote: > > Thank you for the reply > > > > But i am not asking for simple rediredtion. I am aware of the > > (header:"Location:url"); > > > > From a layer i am sending a http_request to an existing application, now > the > > application will response back to the layer. > > > > My concern is how do i make the application response back to the browser > > instead of the layer without changing the code of the application > although > > the request was sent from layer. > > > > This is what i am looking for. Is there some PECL package. > > Please keep your replies on-list for others to benefit. > > What you're asking to do is send a third-party response to the > browser which never instantiates the call to the remote script in the > first place. To my knowledge, it's not possible, which is a good > thing. Otherwise anyone would be able to inject arbitrary responses > (like a man-in-the-middle attack). > > -- > Daniel P. Brown > [Phone Numbers Go Here!] > [They're Hidden From View!] > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. > -- Thanks and Regards Peeyush Gulati +91-9916304135 |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Jan 5, 2008 11:41 AM, peeyush gulati <peeyushgulati@gmail.com> wrote:
> Thank you will do that > > Ok can i redirect the response to the browser from the layer after my layer > has recieved the response from the application. Absolutely. That's the same premise under which the PayPal IPN works. The script ("layer") sends a request to the application, and receives a response, parses it if necessary, and feeds that data back to the client. -- Daniel P. Brown [Phone Numbers Go Here!] [They're Hidden From View!] If at first you don't succeed, stick to what you know best so that you can make enough money to pay someone else to do it for you. |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
Thank you all for your replies.
We just solved it down using HTTP_REQUEST. 1.What we did was using HTTP_REQUEST a request was send to login page with post data credentials like username, password and some other field if required. 2. Then using HTTP_RESPONSE the that were being sent from the application(viz wordpress,mediawiki) to the layer were retrieved into local variables. 3. Finally the were set using set() depending what all were to be set like sessionid, username and so on. 4. Then using header('Location:URL'); the page was directed to desired loggedin page and since the were also set now so the user would not have any issues in navigating through the application. If anyone is still not clear or has some doubts please do tell also suggest if this would have some loop holes. Thanks once again all. Peeyush On Jan 5, 2008 10:18 PM, Daniel Brown <parasane@gmail.com> wrote: > On Jan 5, 2008 11:41 AM, peeyush gulati <peeyushgulati@gmail.com> wrote: > > Thank you will do that > > > > Ok can i redirect the response to the browser from the layer after my > layer > > has recieved the response from the application. > > Absolutely. That's the same premise under which the PayPal IPN > works. The script ("layer") sends a request to the application, and > receives a response, parses it if necessary, and feeds that data back > to the client. > > -- > Daniel P. Brown > [Phone Numbers Go Here!] > [They're Hidden From View!] > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. > -- Thanks and Regards Peeyush Gulati +91-9916304135 |
|
![]() |
| Outils de la discussion | |
|
|