Shareit information via Perl

Discussion in 'Perl Misc' started by Nicolay Vasiliev, Jul 12, 2004.

  1. 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
    Nicolay Vasiliev, Jul 12, 2004
    #1
    1. Advertising

  2. 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.
    Peter Hickman, Jul 12, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z. f.
    Replies:
    0
    Views:
    675
    z. f.
    Feb 3, 2005
  2. subrato
    Replies:
    8
    Views:
    914
    Juan T. Llibre
    Mar 14, 2006
  3. clercmedia
    Replies:
    2
    Views:
    32,275
    clercmedia
    Dec 9, 2005
  4. lerenard001
    Replies:
    0
    Views:
    421
    lerenard001
    Jul 7, 2008
  5. lerenard001
    Replies:
    0
    Views:
    472
    lerenard001
    Jul 9, 2008
Loading...

Share This Page