curl 302 redirect not working (command line)

You need to supply the -L or –location option in order to enable curl to follow HTTP redirects. Quoting from man curl: -L, –location (HTTP/HTTPS) If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo … Read more

Parse Web Site HTML with JAVA [duplicate]

There is a much easier way to do this. I suggest using JSoup. With JSoup you can do things like Document doc = Jsoup.connect(“http://en.wikipedia.org/”).get(); Elements newsHeadlines = doc.select(“#mp-itn b a”); Or if you want the body: Elements body = doc.select(“body”); Or if you want all links: Elements links = doc.select(“body a”); You no longer need … Read more