#!/usr/bin/perl use strict; use warnings; my $key = 'put access key here'; my $passwd = 'put password here'; my @lines_to_parse = ( 'This is a sentence.', 'And this is another sentence.', 'Guess this must be a third sentence, then.' ); my $response = `wget -nv -q "https://edu.visl.dk/tools/remoting/?auth_key=$key" -O -`; $response =~ m/VISLSessionID=([a-z0-9]+)/isg; my $VISLSessionID = "$1"; $response =~ m/auth_chap=([a-z0-9]+)/isg; my $auth_chap = "$1"; print "VISLSessionID is $VISLSessionID auth_chap is $auth_chap "; my $auth_passwd = `echo -n "$passwd" | sha1sum`; $auth_passwd =~ s/[^a-z0-9]//isg; # sha1sum is not clean output; cleaning it up $auth_passwd = `echo -n "$auth_passwd$auth_chap" | sha1sum`; $auth_passwd =~ s/[^a-z0-9]//isg; print "auth_password is $auth_passwd "; $response = `wget -nv -q "https://edu.visl.dk/tools/remoting/?VISLSessionID=$VISLSessionID&auth_password=$auth_passwd" -O -`; $response =~ m/auth_status=([a-z0-9]+)/isg; my $auth_status = "$1"; print "auth_status is $auth_status "; if ($auth_status ne "1") { die("Authentication Error: $auth_status"); } foreach (@lines_to_parse) { $response = `wget -nv -q "https://edu.visl.dk/tools/remoting/?VISLSessionID=$VISLSessionID&lang=en&text=$_" -O -`; print "The line \"$_\" returned a parse result of:"; print "\n$response\n\n"; }