Re[2]: [PHP-GTK] Calling IE for a form POST

From: Date: Wed, 20 Jul 2005 22:19:47 +0000
Subject: Re[2]: [PHP-GTK] Calling IE for a form POST
References: 1 2 3 4  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-6084@lists.php.net to get a copy of this message
Hi, Thursday, July 21, 2005, 4:40:13 AM, you wrote: BS> LibCURL is called by PHP, it does not instruct the browser to send an HTTP BS> POST. Thus, it's not really any benefit over using fsockopen except maybe to BS> make the coding a bit easier. (and make error handling more imprecise) BS> The issue isn't "how do I submit XYZ data via POST" - that's EASY, but BS> "How BS> can I submit XYZ data in a browser, so that the user can continue to act in BS> the browser, by submitting their login/pw via POST?". Effectively, I want to BS> hand off the user to a website using the same credentials they used to login BS> to the PHP-GTK application. So far, I've only found hackish workarounds, BS> never a clean API to tell XYZ browser to "submit N data via post to X site BS> and then let the user take it from there". BS> -Ben BS> On Wednesday 20 July 2005 08:30, Gonzalo Monzón wrote: >> Hi all, >> >> I think the lib_curl php extension is all what you need. >> >> You can send POST data, authenticathe an user, etc. >> >> Have a look to this url: >> http://curl.haxx.se/libcurl/php/examples/ >> >> Gonzalo. >> >> >> Benjamin Smith escribió: >> >> >Scott, >> > >> >In this case, that still leaves the user unauthenticated. I need to BS> (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 BS> 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 BS> past >> >authentication. >> > >> >EG: >> > >> >/********************************************* >> >special_login_script.php generates a login token that can only be used BS> 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 >> >> >> >> >> >> >> >> >> > >> > >> > >> >> -- >> PHP-GTK General Mailing List (http://gtk.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> BS> -- BS> "The best way to predict the future is to invent it." BS> - XEROX PARC slogan, circa 1978 After the form just do a javascript submit, possibly like this <html> <head> <title>Submit</title> </head> <body> <form name="form1" action="http://wherever.com/index.php" method="post"> <input type="hidden" name="username" value="usera"> <input type="hidden" name="password" value="pass"> </form> <script type="javascript">form1.submit();</script> </body> </html> Feed that to IE as a string via the com interface. - regards, Tom

« previous php.gtk.general (#6084) next »