By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

Filling out forms remote

P: n/a
Is it possible to fill out a form on an foreign website.
E.g. is it possible to fill out the google form from a php script
and then initialize the search?

Thx

Axel
Jun 2 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Radium wrote:
Is it possible to fill out a form on an foreign website.
E.g. is it possible to fill out the google form from a php script
and then initialize the search?


Yes...just copy form code, and change the form action. Its not about
php its just html code.

e.g for google:
<form action=http://www.google.com/search>
<input type=text name=q>
<input type=submit value=Search>
</form>

regards,

Lorento
--
http://www.mastervb.net
http://www.immersivelounge.com
http://www.padbuilder.com

Jun 3 '06 #2

P: n/a
Yes, but what if the website with the forms uses sessions.
For example bank accounts logins often open sessions, as soon es you open
the website
with the login form. Is it possible to handle this situation with php....

One would have to load the website like a browser with php, and then fill
out the forms,
redirect the output of the website to a real user browser.

Thx in advance

Axel
"lorento" <la**********@yahoo.com> schrieb im Newsbeitrag
news:11**********************@i40g2000cwc.googlegr oups.com...
Radium wrote:
Is it possible to fill out a form on an foreign website.
E.g. is it possible to fill out the google form from a php script
and then initialize the search?


Yes...just copy form code, and change the form action. Its not about
php its just html code.

e.g for google:
<form action=http://www.google.com/search>
<input type=text name=q>
<input type=submit value=Search>
</form>

regards,

Lorento
--
http://www.mastervb.net
http://www.immersivelounge.com
http://www.padbuilder.com

Jun 3 '06 #3

P: n/a
Radium wrote:
Is it possible to fill out a form on an foreign website.
E.g. is it possible to fill out the google form from a php script
and then initialize the search?


Two appoaches that you can take:
1. The standard way is using http://php.net/curl and friends: You
could examine the html for the page and then manually construct the
string for the form that you wish to submit. The page examination may
either be done beforehand to determine its form (as with google, whose
requirements are straighforward) or on the fly (if there is information
the server sends that needs to be returned). This approach will break
if the page in question relies on javascript.

2. If you are on windows, you can use http://php.net/com: You can
bring up a copy of InternetExplorer ($ie=new
COM("InternetExplorer.Application") - see
http://php.net/manual/class.com.php) and work directly with the DOM.
That is, you can fill out the real live form, submit it, and the answer
comes back to the $ie COM object. This is a more powerful paradigm,
but not for the faint of heart.

The documentation says you shouldn't do this (when running php server
side. PHP CLI is fine) and that all sorts of mean, nasty, and ugly
things will happen if you do, but you can. However, there is a
limitation which I do consider significant when doing this server side:
the proper way to do this kind of thing (web page sequencing, that is)
is to use event driven programming (ie. you submit the page, it loads,
and when it's finished loading the appropriate php function gets called
- see http://php.net/com-event-sink).

The thing that happens is that your web server runs under security
restrictions. Specifically, COM objects are limited in what they can
do. In particular, COM objects are not allowed to interact with the
system at large, nor are they allowed to interact with other running
programs. These restrictions are understandable and reasonable since
your server is supposed to be running in a sandbox. However, PHP goes
too far and doesn't allow event sinking with IE in this instance. It
appears that this is a bug with PHP because if you use VBScript in the
same way at this point (indeed, if you have PHP call VBScript at this
point), then that VBScript's IE can be event driven, no problem, even
within the sandbox. The only recourse that I have found is to use
polling (ugh!).

Csaba Gabor from Vienna

Jun 3 '06 #4

P: n/a
Wow, will take a month to get through all those possibilities...

Thx man!

Axel
"Csaba Gabor" <da*****@gmail.com> schrieb im Newsbeitrag
news:11**********************@y43g2000cwc.googlegr oups.com...
Radium wrote:
Is it possible to fill out a form on an foreign website.
E.g. is it possible to fill out the google form from a php script
and then initialize the search?


Two appoaches that you can take:
1. The standard way is using http://php.net/curl and friends: You
could examine the html for the page and then manually construct the
string for the form that you wish to submit. The page examination may
either be done beforehand to determine its form (as with google, whose
requirements are straighforward) or on the fly (if there is information
the server sends that needs to be returned). This approach will break
if the page in question relies on javascript.

2. If you are on windows, you can use http://php.net/com: You can
bring up a copy of InternetExplorer ($ie=new
COM("InternetExplorer.Application") - see
http://php.net/manual/class.com.php) and work directly with the DOM.
That is, you can fill out the real live form, submit it, and the answer
comes back to the $ie COM object. This is a more powerful paradigm,
but not for the faint of heart.

The documentation says you shouldn't do this (when running php server
side. PHP CLI is fine) and that all sorts of mean, nasty, and ugly
things will happen if you do, but you can. However, there is a
limitation which I do consider significant when doing this server side:
the proper way to do this kind of thing (web page sequencing, that is)
is to use event driven programming (ie. you submit the page, it loads,
and when it's finished loading the appropriate php function gets called
- see http://php.net/com-event-sink).

The thing that happens is that your web server runs under security
restrictions. Specifically, COM objects are limited in what they can
do. In particular, COM objects are not allowed to interact with the
system at large, nor are they allowed to interact with other running
programs. These restrictions are understandable and reasonable since
your server is supposed to be running in a sandbox. However, PHP goes
too far and doesn't allow event sinking with IE in this instance. It
appears that this is a bug with PHP because if you use VBScript in the
same way at this point (indeed, if you have PHP call VBScript at this
point), then that VBScript's IE can be event driven, no problem, even
within the sandbox. The only recourse that I have found is to use
polling (ugh!).

Csaba Gabor from Vienna

Jun 3 '06 #5

P: n/a
Radium wrote:
Yes, but what if the website with the forms uses sessions.
For example bank accounts logins often open sessions, as soon es you open
the website
with the login form. Is it possible to handle this situation with php....

One would have to load the website like a browser with php, and then fill
out the forms,
redirect the output of the website to a real user browser.

Thx in advance

Axel


Radium,

That's the hard way. CURL can handle it just fine.

And please don't top post.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jun 3 '06 #6

P: n/a
On Sat, 03 Jun 2006 11:15:15 +0200, Radium wrote:
Wow, will take a month to get through all those possibilities...


It's still much simpler then LWP.

--
http://www.mgogala.com

Jun 3 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.