Re: Calling IE for a form POST
| From: | Benjamin Smith | Date: | Tue, 19 Jul 2005 19:39:20 +0000 |
| Subject: | Re: Calling IE for a form POST | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6078@lists.php.net to get a copy of this message | ||
Scott,
In this case, that still leaves the user unauthenticated. I need to (somehow)
pass the user to the web-based thingy with login/pw passed so that the PHP
session is active, links work, etc.
The only thing I've come up with so far is to pass the credentials in PHP-GTK
using fopen or fsockopen or your aforementioned PEAR lib, get a one-time
token via a special script on the server, and then use that token to get past
authentication.
EG:
/*********************************************
special_login_script.php generates a login token that can only be used once,
then it's deleted.
*********************************************
$fp=fopen("https://mysite.com/special_login_script.php?_login=$login&_pass=$pass",
'r');
$match="/token: ([0-9a-zA-Z]*)/";
while ($line=fgets($fp, 1024))
if (preg_match($match, $line, $r))
$token=$r[1];
fclose($fp);
/*******************************************
Now, we'll use the token we got above to login the user to the
script/in/question.php
*******************************************/
$url="https://mysite.com/script/in/question.php?_token=$token&login=true";
return HandOffWithIE($url);
This passes the user to the web-based application, which disables the token
(almost) immediately, and has the user logged in painlessly. It's just more
work, and I figure it's more "right" just to pass via post in the first
place!
Having just checked my inbox, it seems Christian Weiske proposes something
similar to the above.
-Ben
On Tuesday 19 July 2005 12:10, Scott Mattocks wrote:
> Benjamin Smith wrote:
>
> > In this case, it's to integrate a PHP-GTK application with a web-based
one.
> > It's not just for passing data - the user will be using the website after
a
> > hand-off.
> >
> > I'd like to use the form post to pass the login credentials in a manner
hidden
> > from the user, so that I'm not littering a browser's site history with
> > usernames and passwords, etc.
> >
> > Once the form post is done in IE, the user must interact with the
web-based
> > application, so it can't be done directly from PHP-GTK.
>
> I don't know much about COM and IE but is it possible to launch IE and
> pass it a string to display? Something similar to:
>
> $reply = $httpRequest->send();
> $ie = new IE();
> $ie->load($reply);
> $ie->launch();
>
> Scott
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
"The best way to predict the future is to invent it."
- XEROX PARC slogan, circa 1978