Results 1 to 8 of 8
Thread: Fetch Source Code
- 02-07-2011, 10:24 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
Fetch Source Code
Hi to all,
I'm fetching the source code of the Web Page by using HttpURLConnection. But in some Sites , the exact Source code that i want is not Fetched instead it redirects to some other Web Pages. Is there anyBody having idea how I have to fetch the Source code of Redirected WebPages.
Thanks in Advace
Ujjwal Khajuria
- 02-07-2011, 03:11 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
HttpURLConnection should follow redirects by default. If you do not want this to be the case, set setFollowRedirects to false.
- 02-07-2011, 08:34 PM #3
You can also go old school low level and just open sockets to the server in question. Thats a lot more work of course, but probably twice if not three times as awesome.
- 02-07-2011, 08:44 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 30
- Rep Power
- 0
Last edited by codesmuggler; 02-07-2011 at 08:46 PM.
- 02-07-2011, 08:48 PM #5
I just dial into the website with my phone and scream binary tones into the receiver and handwrite the response... in octal :P
- 02-08-2011, 03:58 AM #6
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
It doesn't Fetch the Source Code of the URL That I inserted. instead It fetch the Source code of URL that is Redirected by the previous URL
- 02-08-2011, 04:00 AM #7
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
- 02-08-2011, 04:22 PM #8
Like I said, thats because of the level of the network stack you are on. Java's URL connections are automatically following the redirect. The thing is, if you are getting a HTTP 302 response from the server, then the page itself probably doesn't have any content. I would be curious exactly what message you are getting from the server in response to the initial query.
Similar Threads
-
source code
By patel_op in forum NetworkingReplies: 0Last Post: 11-18-2010, 08:59 AM -
Help me source code
By choqi Amt in forum NetBeansReplies: 2Last Post: 07-18-2010, 09:57 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 fetch an arralist element (i need the code)
By raj reddy in forum JavaServer Pages (JSP) and JSTLReplies: 7Last Post: 04-21-2008, 03:28 AM -
Need a source code
By vissu007 in forum New To JavaReplies: 1Last Post: 07-05-2007, 07:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks