PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > http_request
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
http_request

Réponse
 
LinkBack Outils de la discussion
Vieux 05/01/2008, 14h06   #1
peeyush gulati
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut http_request

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
  Réponse avec citation
Vieux 05/01/2008, 15h44   #2
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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.
  Réponse avec citation
Vieux 05/01/2008, 15h59   #3
Dave Goodchild
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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
>
>


  Réponse avec citation
Vieux 05/01/2008, 16h05   #4
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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.
  Réponse avec citation
Vieux 05/01/2008, 16h12   #5
Dave Goodchild
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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.
>


  Réponse avec citation
Vieux 05/01/2008, 16h35   #6
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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.
  Réponse avec citation
Vieux 05/01/2008, 16h41   #7
peeyush gulati
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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

  Réponse avec citation
Vieux 05/01/2008, 16h48   #8
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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.
  Réponse avec citation
Vieux 09/01/2008, 18h33   #9
peeyush gulati
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] http_request

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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h39.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20901 seconds with 17 queries