Greetings Sir,
I am not familiar with J myself, but I believe you have not logged in to the
site, that is needed in order to get the image. In http terms you need to set
the cookie you get when providing the correct credentials.
In my case i program in perl and i have made a function in order to log into
hts programmatically. The $ua object is a global variable that holds state
like cookies and other useragent settings.
I am not familiar with J, what mechanisms you have available for storing the
cookies the website sends you, but when you login you have to save the
Set-Cookie header field and resend it as a Cookie header field in subsequent
requests.
I hope this clears it up and will get you on the path.
- Code: Select all
sub siteLogin {
my $login = shift;
my $pass = shift;
my $req = HTTP::Request->new(POST => "https://www.hackthissite.org/user/login");
$req->header('Host', 'www.hackthissite.org');
$req->header('Referer', 'https://www.hackthissite.org/');
$req->content_type('application/x-www-form-urlencoded');
$req->content("username=" . $login . "&password=" . $pass . "&btn_submit=Login");
my $res = $ua->request($req);
return 1;
}