#!usr/local/bin/perl use LWP::Simple; use Data::Dumper; use LWP::UserAgent; use HTTP::Request::Common qw/POST/; LWP::Debug::level('+') ; push(@INC, '/opt/customer/apps/sun-83/nes363/suitespot/cgi-bin/lib/LWP/') ; my $ua= LWP::UserAgent->new; my $file="/home/hewebadm/nilay/test1.txt" ; my $filename="323272-1980-test1.txt" ; open(READFILE, "<$file") ; @data= ; # Have to post the file and parameters at this URL # my $url="http://downloaddev.pearsoncmg.com/extmanage/extpost.php" ; # I Have hard coded the parameters for now# $request = POST $url, Content_Type => 'application/x-www-form-urlencoded', Content => [ action => "insert", file => "@data",#have tried with file=>$file filename => "$filename", parentisbn => "0131406701", linktext => "test1.txt",#present in curr dir type => "Presentations", imprint =>"ph" , ] ; my $results=$ua->request($request ); print Dumper($results); if($results->is_success){ print $results->as_string() ; print $results->status_line(); } #### LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: POST http://downloaddev.pearsoncmg.com/extmanage/extpost.php LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 12 bytes LWP::UserAgent::request: Simple response: OK $VAR1 = bless( { '_protocol' => 'HTTP/1.1', '_content' => 'ERROR: ', '_rc' => '200', '_headers' => bless( { 'connection' => 'close', 'x-powered-by' => 'PHP/4.2.2', 'client-response-num' => 1, 'date' => 'Sat, 31 Jan 2004 0:57:02 GMT', 'client-peer' =>'209.202.161.174:80', 'client-date' => 'Sat, 31 Jan 200410:57:04 GMT', 'content-type' => 'text/html', 'server' => 'Apache/1.3.20 (Unix) PHP/4.2.2', 'client-transfer-encoding' => 'chunked' }, 'HTTP::Headers' ), '_msg' => 'OK', '_request' => bless( { '_content' => 'action=insert&file=abcsssss%0A+sad%0A+asd%0A+asd%0A+asd%0A+asd%0A+asda%0A+s das%0A+dasd%0A+fsdf%0A+sdf%0A+sdf%0A+sdf%0A+sdfa%0A+dfasd%0A+fas%0A+dfas%0A+ dfs%0A+df%0A+sdf%0A+f%0A&filename=323272-1980-test1.txt&parentisbn=013140670 1&linktext=test1.txt&type=Presentations&imprint=ph', '_uri' => bless( do{\(my $o = 'http://downloaddev.pearsoncmg.com/extmanage/extpost.php')}, 'URI::http' ), '_headers' => bless( { 'user-agent' => 'libwww-perl/5.76', 'content-type' => 'application/x-www-form-urlencoded', 'content-length' => 339 }, 'HTTP::Headers' ), '_method' => 'POST' }, 'HTTP::Request' ) }, 'HTTP::Response' ); HTTP/1.1 200 OK Connection: close Date: Sat, 31 Jan 2004 10:57:02 GMT Server: Apache/1.3.20 (Unix) PHP/4.2.2 Content-Type: text/html Client-Date: Sat, 31 Jan 2004 10:57:04 GMT Client-Peer: 209.202.161.174:80 Client-Response-Num: 1 Client-Transfer-Encoding: chunked X-Powered-By: PHP/4.2.2 ERROR: 200 OK ERROR: