Re: Calling IE for a form POST

From: Date: Wed, 20 Jul 2005 18:40:13 +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-6083@lists.php.net to get a copy of this message
LibCURL is called by PHP, it does not instruct the browser to send an HTTP POST. Thus, it's not really any benefit over using fsockopen except maybe to make the coding a bit easier. (and make error handling more imprecise) The issue isn't "how do I submit XYZ data via POST" - that's EASY, but "How can I submit XYZ data in a browser, so that the user can continue to act in the browser, by submitting their login/pw via POST?". Effectively, I want to hand off the user to a website using the same credentials they used to login to the PHP-GTK application. So far, I've only found hackish workarounds, never a clean API to tell XYZ browser to "submit N data via post to X site and then let the user take it from there". -Ben 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 (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 > >> > >> > >> > >> > > > > > > > > -- > 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

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