CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
http form submit from command line

 



mumairabbasi
New User

May 30, 2003, 8:27 AM

Post #1 of 3 (778 views)
http form submit from command line Can't Post

I am not a perl programmer but i need help creating a script that submit form to http server from command line.

The problem:

I have a ACC Tigris access server that have a http web interface that we use to monitor and disconect users. The web page for disconnection is a form that take "UserName" and "Disconnect" as input and submit.

I want to have a script that take username as parameter and submit the values to access server like a web page do.

e.g.

#./disconnect.sh username

Keep in mind that this page take username and password once for authentication once (may be keep cookie in webbrowser).

The form code:

<FORM METHOD=POST ACTION="http://202.x.x.x/CONFIG/SET/DIAL/USER/CALL/STATE/"><FONT FACE=helvetica>
<br><INPUT SIZE=25 MAXLENGTH=34 TYPE="text" NAME="p1"> USER_NAME
<br><SELECT NAME="p2">
<OPTION VALUE=" ">
<OPTION VALUE="DISCONNECT">DISCONNECT </SELECT> STATE { Optional }
</FONT><BR><INPUT TYPE=submit value="SET DIAL USER CALL STATE "><INPUT TYPE=hidden NAME=pacc_done VALUE="yep"></FORM>

thanks !

Regards,
Umair.


uri
Thaumaturge

May 30, 2003, 8:51 PM

Post #2 of 3 (771 views)
Re: [mumairabbasi] http form submit from command line [In reply to] Can't Post

use LWP or a higher level wrapper WWW::Mechanize. both are on CPAN


Haunter
Novice

Jun 3, 2003, 6:15 PM

Post #3 of 3 (761 views)
Re: [mumairabbasi] http form submit from command line [In reply to] Can't Post


Code
use LWP::UserAgent; 
$ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => 'http://www.perlguru.com/cgi-bin/processor.cgi');
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
my $res = $ua->request($req);
print $res->as_string;



(This post was edited by davorg on Jun 5, 2003, 2:28 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives