Results 1 to 7 of 7
- 01-04-2011, 01:59 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 11
- Rep Power
- 0
download website source code problem
hey,
i am trying to download source code of a webpage but for some webpages i have this error :
Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: xxxxxx at sun.net.http://www.protocol.http.HttpURLConn...tion.java:1441)
at java.net.URL.openStream(URL.java:1010)
at WebsiteReader.read(WebsiteReader.java:7)
at WebsiteReader.main(WebsiteReader.java:13)
and this is my code
:
import java.io.*;
import java.net.URL;
.
.
.
public static BufferedReader read(String url) throws Exception{
return new BufferedReader(
new InputStreamReader(
new URL(url).openStream()));}
public static void main (String[] args) throws Exception{
BufferedReader reader = read("http://www........");
String line = reader.readLine();
.
.
.
any help please .
- 01-04-2011, 04:07 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,459
- Rep Power
- 16
Have you tried to enter that URL into your browser?
A 403 is a Forbidden error.
- 01-04-2011, 04:28 PM #3
Member
- Join Date
- Mar 2010
- Posts
- 11
- Rep Power
- 0
source code
yes i entered the url and it works fine and i was able to see the source code in the browser firefox , i was reading on the internet i think there is a proxy problem and i am not familiar with the proxies !!!
- 01-04-2011, 04:35 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,459
- Rep Power
- 16
Do you know what traffic is going on when you make the request from your browser?
I'd look at that if I were you.
- 01-04-2011, 04:38 PM #5
Member
- Join Date
- Mar 2010
- Posts
- 11
- Rep Power
- 0
question
i know this is maybe a stupid question but how can i do that and how can that help me ! thanks for your patience .
- 01-04-2011, 04:45 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,459
- Rep Power
- 16
Sorry, should have thought of that!
I use Firebug for Firefox, which has a Console window in which all the calls to the server, and the response, are logged. I suspect there's something similar for whatever browser you're using.
This may not be your problem, but at least you'll be able to see if anything else is happening.
- 01-04-2011, 05:17 PM #7
Member
- Join Date
- Mar 2010
- Posts
- 11
- Rep Power
- 0
Similar Threads
-
[Java] getting links from website source
By pietertje in forum New To JavaReplies: 6Last Post: 07-01-2010, 09:36 PM -
Download Free Open Source Software lucid work for Solr
By kevi in forum LuceneReplies: 0Last Post: 03-27-2010, 11:21 AM -
How to download data from a website.
By bobrenjc93 in forum Java AppletsReplies: 2Last Post: 05-15-2009, 07:08 AM -
MavenJava - browse source code of all open source projects online
By jirkacelak in forum Java SoftwareReplies: 1Last Post: 11-28-2008, 06:27 PM -
How to download website (Get all link in website)
By finalmem in forum Advanced JavaReplies: 0Last Post: 11-12-2008, 08:43 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks