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; }
In reply to Rest API testing with perl by madhurivepa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |