1) you will definitelypossibly need the cookies. You can either manually add a cookie header with the value listed, or you can use a cookie jar.

2) Try backing out from using the ua->post method to creating a post from HTTP::Request::Common so you can interact with and examine it.

3) note that the outgoing request was text/plain. No URL encoding was done.

Turns out you just need it in the format it wants, and will accept text/plain or x/www-form-encoded content.

#!/usr/bin/perl use warnings; use strict; use HTTP::Request::Common; use LWP::UserAgent; use Data::Dumper; my %fields = ( "LeagueID" => "9\r\n", "GameDate" => "3-2-2010\r\n", "Season" => "2009-2010\r\n", "Refresh" => "false\r\n", "LastUpdateTime" => "01-01-1900\r\n", "type" => "Matchups\r\n", "RefreshStartTime" => "11-2-2010-1268372427240\r\n", "Week" => "\r\n", "conferenceID" => "", ); my $robot = LWP::UserAgent->new; use HTTP::Request::Common; my $url = 'http://scores.covers.com/ajax/SportsDirect.Controls.LiveScoresC +ontrols.Scoreboard,SportsDirect.Controls.LiveScoresControls.ashx?_met +hod=UpdateScoreboard&_session=no'; my $post = POST $url , \%fields; # $post would be url-encoded # 'content-type' => 'application/x-www-form-urlencoded', # print Dumper $post; my $content = qq{LeagueID=9\r\nGameDate=3-2-2010\r\nSeason=2009-2010\r +\nRefresh=true\r\nLastUpdateTime=01-01-1900\r\ntype=Matchups\r\nRefre +shStartTime=12-2-2010-1268408433293\r\nWeek=\r\nconferenceID=}; # your target url appears to accept either of these my $post2 = POST $url, Content => $content; #my $post2 = POST $url, 'content-type' => 'text/plain', Content => $co +ntent; print Dumper $post2; print Dumper $robot->request( $post2);
at least I assume this is the sort of output you were expecting:
'_content' => '{\'LeagueID\':9,\'League\':\'NBA\',\'GameDate\':\'3-2- +2010\',\'Season\':\'2009-2010\',\'Week\':\'\',\'GameResponseList\':[] +,\'LastUpdateTime\':\'01-01-1900\',\'RefreshStartTime\':\'12-2-2010-1 +268408433293\',\'Refresh\':true,\'PageType\':\'Matchups\',\'ScoreBoar +dHTML\':\'<div id="Scoreboard_9"><table class="scoreboard" border="0" +>\\r\\n <tr>\\r\\n <td class="scoreboard-left"><div + id="Game_9_781166" class="game-box"><span class="activetab" id="In_G +ame_Status_9_781166">Final</span><div class="soright" id="Title_9_781 +166">Boston at Detroit</div><span class="pick_button"><a href="http:/ +/contests.covers.com/sportscontests/makepicks.aspx?sportID=9&EventID= +781166"><img src="http://images.covers.com/scores/general/pick.gif" a +lign="absmiddle" alt="contest pick" border="0"

In reply to Re^3: Trying to Copy Live Http Replay by spazm
in thread Trying to Copy Live Http Replay by sstevens

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.