Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Shareit information via Perl

Reply
Thread Tools

Shareit information via Perl

 
 
Nicolay Vasiliev
Guest
Posts: n/a
 
      07-12-2004
Hello, there!

I am trying to connect into ShareIt system. I need to refresh my sales
information automatically. I know LWP is power to help me, but I try and
get nothing positive yet.

What I am doing:

#!/usr/bin/perl

use LWP::UserAgent;
use LWP::Simple;
use HTTP::Request::Common qw(POST);
use strict;
use warnings;

print "Content-type: text/html; charset=windows-1251\n\n";

$|++;


my $cont = get("https://secure.shareit.com/shareit/cp/login/index.html");

my ($uri, $sessid, $random);

if ($cont =~ /.*=(\d+)&.*=(\w+)"/g) {
$uri =
"https://secure.shareit.com/shareit/cp/login/index.html?sessionid=$1&random=$2";
($sessid, $random) = ($1, $2);
}

my $ua = LWP::UserAgent->new();
$ua->agent("Superzilla/v4.11 Platinum");
my $req = POST $uri,
[PUBLISHER_ID => "mylogin",
PASSWORD => "password"];

$cont = $ua->request($req)->as_string;
print $cont;

exit();

When I make POST and print then the variable $cont I get the login page
again. Where is a mistake?

Thank you in advance.

Nicolay A. Vasiliev

 
Reply With Quote
 
 
 
 
Peter Hickman
Guest
Posts: n/a
 
      07-12-2004
Nicolay Vasiliev wrote:
> When I make POST and print then the variable $cont I get the login page
> again. Where is a mistake?


There is no continuity between the get and the request. As far as the ShareIT
site is concerned the two request are two different sessions. I would enable
cookies in your user agent and use that to get your first page. That will
probably set a cookie that you require and then the second request will be seen
as part of the same session.

Least ways that's how we do it.

Having said that I have yet to play about with HTTPS in LWP so I don't know if
there are any other issues, like certificates.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
signer information does not match signer information of other classes in the same pac lerenard001 Java 0 07-07-2008 03:46 PM
Information technology is incomplete without information security alannis.albert@googlemail.com Computer Support 0 04-14-2008 06:42 AM
More Information than just IIS Log Information subrato ASP .Net 8 03-14-2006 09:59 PM
signer information does not match signer information of other classes in the same package clercmedia Java 2 12-09-2005 03:14 PM
strange information from asp.net trace / getting performance information using WebRequest and StreamReader z. f. ASP .Net 0 02-03-2005 11:23 AM



Advertisments