Need to scrape the data from aspx webpage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ramkumar85
    New Member
    • Jan 2012
    • 8

    Need to scrape the data from aspx webpage

    Hi All,

    I need to scrape the data from the URL "https://hms.portxcs.nl/oper/Public/PublicMovements .aspx".

    Here we give the dropdown box for "Time" should be "Next 7 Days" and "Port" should be "Vlissingen " Finally click the "Search" button.

    Web page shows some records about the given credentials. I want to scrape that datas.

    I used the below mentioned code to scrape.

    my $inurl="https://hms.portxcs.nl/oper/Public/PublicMovements .aspx";
    my $inurl1 = $inurl;

    ## Here we get the name of the button and value of the text box.
    my $searchform = 'aspnetForm';
    my $searchfield = 'ctl00$MP$GPSea rchFrame$fldTIM E$listComboBox' ;
    my $searchterm = 'Next 7 Days';
    my $searchfield1 = 'ctl00$MP$GPSea rchFrame$fldPOR T$listComboBox' ;
    my $searchterm1 = '2';

    my $searchbutton = 'ctl00$MP$GPSea rchFrame$btnSea rchBy';
    # turn on perl's safety features
    our $agent = WWW::Mechanize->new( autocheck => 1 );
    $agent->get($inurl);
    $agent->form_name($sea rchform);
    $agent->field($searchf ield, $searchterm);
    $agent->field($searchf ield1, $searchterm1);
    $agent->click($searchb utton);

    my $content = $agent->content();

    open(FH,">$outf ile")|| die("Cannot Open File");
    binmode(FH, ":utf8");
    print FH $content;
    close FH;

    But its provide only the firstpage data.

    I have attached the screenshot for your reference.

    Kindly let me know.

    Regards,
    Ram
    Attached Files
  • chorny
    Recognized Expert New Member
    • Jan 2008
    • 80

    #2
    HTML::TreeBuild erX::ASP_NET may help you.

    Comment

    Working...