POST scraper error Itaú

0

I'm doing a JAVA Scraper for Itaú's mobile site and I have the error below:

Asperthecode,I'mgettingtheGETtogetasessionandthenthePOSTwiththerequiredparametersandheaders(thesameonesdoneinPython henriquebastos ).

I believe this is the default redirect page in case of an error. I think the error is in the LOGIN () method that does the POST.

Sniffing the request with Fiddler, these are the parameters sent:

CouldyoutellmeifI'msettingtheheadersandparameterscorrectlyinPOST?

//ListdataforHttpPostparametersList<NameValuePair>arguments=newArrayList<>(3);arguments.add(newBasicNameValuePair("ctl00$ContentPlaceHolder1$txtAgenciaT", agency));
        arguments.add(new BasicNameValuePair("ctl00$ContentPlaceHolder1$txtContaT", accountNumber));
        arguments.add(new BasicNameValuePair("ctl00$ContentPlaceHolder1$txtDACT", accountDigit));
        arguments.add(new BasicNameValuePair("ctl00$ContentPlaceHolder1$txtPassT", password));
        arguments.add(new BasicNameValuePair("ctl00$ContentPlaceHolder1$btnLogInT.x", "12"));
        arguments.add(new BasicNameValuePair("ctl00$ContentPlaceHolder1$btnLogInT.y", "14"));
        arguments.add(new BasicNameValuePair("ctl00$hddAppTokenApp", ""));
        arguments.add(new BasicNameValuePair("ctl00$hddExisteApp", ""));

        // Set header
        post.setHeader("User-Agent", "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Mobile Safari/537.36");
        post.setHeader("Accept", "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Mobile Safari/537.36");
        post.setHeader("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4");

        // Do post
        try
        {
            post.setEntity(new UrlEncodedFormEntity(arguments));
            HttpResponse response = httpClient.execute(post);

            // Print out the response message
            System.out.println(EntityUtils.toString(response.getEntity()));
            System.out.println("\nResponse Status: " + response.getStatusLine().getStatusCode());

            return response;
        } catch (IOException e)
        {
            System.out.println(e);
            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, e);
        }
    
asked by anonymous 22.01.2018 / 23:32

0 answers