![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
I know there is a way for a script to query a web site through POST i.e. to fill out a form. What language should I use to do this and how hard is it to write?
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Actually I have successfully done this with Perl, PHP, and C++ (using MSIEX controls). You can simulate page form completions via POST and GET, of course GET is a little bit easier to do.
If you are using PHP, which is probably the easiest to use here, you have three ways of accomplishing your desired task... 1) Use the CURL libraries, send a CURL request and set the data transmmission to HTTP POST. $c = curl_init( 'http://www.example.com/submit.php' ); curl_setopt( $c, CURLOPT_POST, 1 ); curl_setopt( $c, CURLOPT_POSTFIELDS, 'monkey=uncle&rhino=aunt' ); curl_setopt( $c, CURLOPT_RETURNTRANSFER, 1 ); //return the resulting HTML $page = curl_exec( $c ); curl_close( $c ); 2) You can download and use the PEAR HTTP_Request class to accomplish the same thing, in a slightly more object oriented manner. $r = new HTTP_Request( 'http://www.example.com/submit.php' ); $r->setMethod( HTTP_REQUEST_METHOD_POST ); $r->addPostData( 'monkey', 'uncle' ); $r->addPostData( 'rhino', 'aunt' ); $r->sendRequest( ); $page = $r->getResponseBody( ); unset( $r ); 3) Making a raw socket connection with the HTTP server and posting custom formatted headers which equate to the POST string you want to set along, this is stupidly complex if you have access to one of the above classes and I would recommend not bothering with it, since it tends not to be a very robust solution. Good luck.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#3 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
Thank you for the invaluable help! I don't know PHP at the moment. But this is important enough to me that I will learn it.
Thanks!
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|