madhurivepa has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to set a send a session id to a webpage. I am not sure what's wrong. The connection is failing and I am getting the response as C:\Automation\API_Test\API_Test\Scripts>perl cookies.pl fail 500 at cookies.pl line 22.
Could you please help.#!/usr/bin/perl -l use LWP::UserAgent; use HTTP::Cookies; # sending cookies as a part of header $sessionKey = "session"; $sessionId = "1399663809196"; my $ua = LWP::UserAgent->new; $request = HTTP::Request->new(POST => 'https://localhost:4096/CVTLAPI/ +DV/libraries/15.154.52.112'); my $cookies = HTTP::Cookies->new(); $cookies->set_cookie(0,'session',$sessionId); $ua->cookie_jar($cookies); $response = $ua->request($request); if($response->is_success){ print "sucess\n"; print $response->code; } else { print "fail\n"; die $response->code; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Rest API testing with perl
by moritz (Cardinal) on May 11, 2014 at 19:07 UTC | |
|
Re: Rest API testing with perl
by hippo (Archbishop) on May 11, 2014 at 19:09 UTC | |
by madhurivepa (Novice) on May 12, 2014 at 03:37 UTC | |
by Bloodnok (Vicar) on May 12, 2014 at 09:41 UTC | |
|
Re: Rest API testing with perl
by Anonymous Monk on May 11, 2014 at 21:12 UTC | |
by madhurivepa (Novice) on May 12, 2014 at 03:33 UTC | |
by Anonymous Monk on May 12, 2014 at 06:49 UTC | |
by madhurivepa (Novice) on May 12, 2014 at 07:54 UTC | |
by madhurivepa (Novice) on May 12, 2014 at 07:56 UTC |