Http Error Fetching Url. Status=400
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up HTTP Error fetching URL. Status=400 up vote 0 down vote favorite JSoup seems to work with just about all URLs I've tried but this one gives me the 400 error. String url = "http://localad.walmart.com?storeref=3008&forceview=y"; Response response = Jsoup.connect(url.replaceAll(" ", "%20")) .method(Method.GET) .userAgent("Mozilla") .followRedirects(false) .timeout(5000) .data("pragma", "no-cache") .execute(); Error I get is: Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=http://localad.walmart.com?storeref=3008&forceview=y&pragma=no-cache at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178) jsoup share|improve this question edited May 31 '14 at 3:55 zishe 6,788103272 asked May 31 '14 at 3:50 user2117997 11 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote 400 is Bad Request. You should try URLEncoder.encode(url, "UTF-8") instead of using replaceAll. share|improve this answer answered May 31 '14 at 3:57 J. Titus 3,8951921 I did try that but because the URL has no protocol that throws a MalformedURLException –user2117997 May 31 '14 at 4:33 add a comment| up
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Jsoup parsing, 400 error up vote 1 down vote http://stackoverflow.com/questions/23966210/http-error-fetching-url-status-400 favorite I am writing a program that goes to a web page, finds and downloads all images and common documents (.docx .pdf etc.) and then visits each link on the pages and does the same. The problem I'm running into is when I get deep into parsing links I am getting 400 errors with jsoup: Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=http://www.somerandomurl.com Code: Document http://stackoverflow.com/questions/12738512/jsoup-parsing-400-error doc = Jsoup.connect(urlstring).userAgent("Chrome").get(); Help? parsing jsoup share|improve this question asked Oct 5 '12 at 2:00 theiwarlock 446 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote How do you parse the link (some more code please)? Often its necessary to use an absolut link instead of the simple attribute. share|improve this answer answered Oct 8 '12 at 8:29 ollo 14.5k1053105 add a comment| up vote 0 down vote It's probably a problem with accents or special characters that might be in your url. share|improve this answer answered Feb 14 '14 at 9:44 Maveric78f 205 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged parsing jsoup or ask your own question. asked 4 years ago viewed 1054 times active 2 years ago Blog Stack Overflow Podcast #91 - Can You Stump Nick Craver? Visit Chat Related 1500How do you pars
help others org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=http://scripting.jdpoweronline.com/mrIWeb/mrIWeb.dll#4 https://samebug.io/exceptions/185513/org.jsoup.HttpStatusException/http-error-fetching-url-status400 Stack Overflow | Don | 2 years ago 0 mark URL not working using JSOUP 400 error Stack Overflow | 2 years ago | Don org.jsoup.HttpStatusException: HTTP error fetching URL. Status=400, URL=http://scripting.jdpoweronline.com/mrIWeb/mrIWeb.dll#4 find similars jsoup publicc 0 0 mark JSOUP error fetching url Status 401 Stack Overflow | 2 http error years ago | Anshul Jindal org.jsoup.HttpStatusException: HTTP error fetching URL. Status=401, URL= anyurl find similars jsoup 0 0 mark 搜索引擎爬虫,抓取url - 开源中国社区 oschina.net | 12 months ago org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=http://www.oschina.net/ find similars jsoup com.robot.test 0 Speed up your debug routine! Automated exception http error fetching search integrated into your IDE Test Samebug Integration for IntelliJ IDEA 0 mark Jsoup.parse Mobile url Stack Overflow | 3 years ago | user3368388 org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=http://m.careerbuilder.com/ find similars jsoup 0 0 mark Jsoup intermittent 404 error - how to de-bug? Stack Overflow | 2 years ago | Ribeye org.jsoup.HttpStatusException: HTTP error fetching URL. Status=404, URL=http://localhost/FitNesse.AaaTest find similars jsoup 0 See more Not finding the right solution? Take a tour to get the most out of Samebug. Tired of useless tips? Automated exception search integrated into your IDE Test Samebug Integration for IntelliJ IDEA Root Cause Analysis org.jsoup.HttpStatusException HTTP error fetching URL. Status=400, URL=http://scripting.jdpoweronline.com/mrIWeb/mrIWeb.dll#4 at org.jsoup.helper.HttpConnection$Response.execute() 0 similar jsoup HttpConnection.get org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:449) org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:424) org.jsoup.helper.HttpConnection.execute(HttpConnection.java:178) org.jsoup.helper.HttpConnection.get(HttpConnection.java:167) 6 similar 4 frames publicc JSoupExampleForJDPA.main publicc.JSoupExampleForJDPA.main(JSoupExampleForJDPA.java:41) 0 similar 1 frame About Us Explore Tour Blog Privacy Policy Terms Of Use ©2016 Samebug, Inc. This site uses cookies, as explaine