HTTP Request


Im trying to request some information from a public transportation web site. I'm using the HTTP Request Library. And it have to POST an authentication for then a GET to fetch the information.i'm getting a True return from the POST authentication... but a message : authorization denied.

Any Help?

import http.requests.*;

public void setup() 
  String searchLinha = "8000";

    PostRequest post = new PostRequest("http:" + "//");

  GetRequest linhas = new GetRequest("http:" + "//");


  System.out.println("Reponse Content: " + post.getContent());
  System.out.println("Reponse Content-Length Header: " + post.getHeader("Content-Length"));

  System.out.println("Reponse Content: " + linhas.getContent());
  System.out.println("Reponse Content-Length Header: " + linhas.getHeader("Content-Length"));


the Console:

Apr 25, 2017 3:37:39 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
WARNING: Authentication error: Unable to respond to any of these challenges: {}
Reponse Content: true
Reponse Content-Length Header: 4
Reponse Content: {"Message":"Authorization has been denied for this request."}
Reponse Content-Length Header: 61


Sign In or Register to comment.