7 Replies - 8919 Views - Last Post: 21 December 2005 - 06:37 AM Rate Topic: -----

#1 priyanshuhp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 15-December 05

requesting a web page through httpclient

Posted 19 December 2005 - 03:56 AM

hi all,
I am trying to get the contents of a protected web page by using httpclient in a java program. After requesting a post method to authenticate on the website, when i make a get request for the protected page, it is giving me html which is when copied and saved to an html file and if opened in browser directly forwards you to required protected page. But how to get that page html in program itself.
As the html content i am getting is directly forwarding me to the protected page when opened in browser, so it seems that the authentication is successful but the problem is to get the real html content of that page in program only.

Regards,
Priyanshu

Is This A Good Question/Topic? 0
  • +

Replies To: requesting a web page through httpclient

#2 priyanshuhp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 15-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 03:27 AM

why dont anyone ever reply on this forum. Is this forum dead?
Priyanshu
Was This Post Helpful? 0
  • +
  • -

#3 Datalus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 235
  • Joined: 18-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 03:43 AM

So, when you recieve an html file after you "get" 'ed it from the server, that file isn't that actual page, but a file that links to the actual page.
Was This Post Helpful? 0
  • +
  • -

#4 priyanshuhp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 15-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 05:40 AM

yes u r right....the html i receive has a javascript that processes the necessary redirections. So is there anyway for httpclient to handle the javascript redirections.
Thanks
Priyanshu
Was This Post Helpful? 0
  • +
  • -

#5 Datalus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 235
  • Joined: 18-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 06:16 AM

It seems that the address you pointed at before, was jus the javascript link. You could look at the javascript file you got and copycat what that does in your code. Would that work?
Was This Post Helpful? 0
  • +
  • -

#6 priyanshuhp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 15-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 07:12 AM

Hi Datalus,
The address i am trying to hit is the final page that i wud like to get but why it has so many redirectiions back and forth and finally coming to that link only, is the problem I am facing. I can give u the html content i am receving. If you open that content in the browser you will be redirected to the protected page i am hitting. If you need that html/javascript, i can give it to you.
Thanks,
Priyanshu
Was This Post Helpful? 0
  • +
  • -

#7 Datalus  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 235
  • Joined: 18-December 05

Re: requesting a web page through httpclient

Posted 20 December 2005 - 08:30 PM

Yeah, post the code. Javascript in particular too.
Was This Post Helpful? 0
  • +
  • -

#8 priyanshuhp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 12
  • Joined: 15-December 05

Re: requesting a web page through httpclient

Posted 21 December 2005 - 06:37 AM

Thanks datalus for your replies.
This is the html/javascript i am getting when i make a get request to the required page. Note the if opened in a browser it automatically redirects you to the required page.

<html>
<head>
    <LINK href="http://sns-static.aolcdn.com/sns/3.1/style/snsStyles.css" rel="stylesheet" type="text/css">
    <title>Screen Name Service</title>
    <script LANGUAGE="Javascript" SRC="http://sns-static.aolcdn.com/sns/3.1/js/loginValidations.js"></SCRIPT>
    <script LANGUAGE="Javascript" SRC="http://sns-static.aolcdn.com/sns/3.1/js/window.js"></SCRIPT>
	
<script language="javascript" type="text/javascript">
	prereqchecks('/badbrowser.psp?sitedomain=vatlasaol-gb&authLev=2&siteState=OrigUrl=http%3a%2f%2fab.aolmail.aol.co.uk%2fmain.adp%3flangid%3d257&source=login&lang=en&locale=gb');
</script>
 <noscript>
<p class="snsSmallText"><b> We are sorry, but you will need to enable cookies and Javascript to use your Screen Name with this site.</b><br/> Click <a href="/badbrowser.psp?sitedomain=vatlasaol-gb&authLev=2&siteState=OrigUrl=http%3a%2f%2fab.aolmail.aol.co.uk%2fmain.adp%3flangid%3d257&source=login&lang=en&locale=gb">here</a> if your browser does not automatically redirect you.</p><meta HTTP-EQUIV=Refresh CONTENT="0; URL=/badbrowser.psp?sitedomain=vatlasaol-gb&authLev=2&siteState=OrigUrl=http%3a%2f%2fab.aolmail.aol.co.uk%2fmain.adp%3flangid%3d257&source=login&lang=en&locale=gb"/>
</noscript>
</head>
<script LANGUAGE="Javascript" TYPE="text/javascript">
<!--
    var xdomError = false;
    function checkErrorAndSubmitForm( formName, doPOST, redirUrl){
           if( !xdomError ) {
              snsSubForm( formName, doPOST, redirUrl);
               }
         }
//-->
</SCRIPT>
<script LANGUAGE="Javascript" TYPE="text/javascript"> 
 <!-- 
var reachedServer = false; 
var error = 0; 
var hl0ckVal = 0; 
var hckVal = 0; 
var time = new Date(); 
time.setFullYear(time.getFullYear() + 30);
function snsXDomError() { 
   xdomError = true; 
   var failUrl = "http://www.aol.co.uk?error=16&siteId=vatlasaol-gb&authLev=2&siteState=OrigUrl%3Dhttp%253a%252f%252fab.aolmail.aol.co.uk%252fmain.adp%253flangid%253d257&lang=en&locale=gb";
snsRedir(failUrl); 
} 
 //--> 
</SCRIPT> 
<script LANGUAGE="Javascript" SRC="http://sns.cqr.aolmail.aol.co.uk:80/_cqr/xdomain/final.psp?siteId=vatlasaol-gb&MC_CMP_SX=diAxLjAga2lkIDIwMDIwODE0MDEwMDAyMDAwMA%253D%253D-6g88r8LqrqIwbdhDRtyUwpLC6bj%252BQ49HKbG4yhu7bub9RWtFh12zNBnsyz6J5YiDQ8MWSPRmTr5yvYZABRDEhcHqu0fxfndwnvadBDqiWNhtt4C6J156jJWgTyxX1M7VoWPYhLose1fg31sLO99fzylqswimeplCYIlf5pp43jsY2w9UM8C%252B%252BMaasNB81fTXeG9L42iNjvhpLrHGUMffgq2I4UQ6ueWFoK5rdOZiyZ5UknMWu%252BFgElWRPKcic6VLQqH%252BXKrBgpzugmrZngjoOuYCa4XWkrlva7ed8GjC3qOgZf3xf4cSFaNd7oXjkh53UOPsLYWCcWnW5LyhywIOaZpocj9NzS0FfvJ1saWzASFBqoO7d5AgTDdcBawvQpAIJmUfALQHafiCnw%252F3LPxuuI0%252FkP0tH4ef9%252BasJITyL3eVQteeWZmyh%252Bs6v4UXZxo0MzFmRmlrxwlFs7h3FltOuQesUkfVCsmb7MiblkHrDKmMyvNHIt%252Bvmz5BPrt4ktNyWwDr4Int8YkZBdzD8qUdzdWxdB2bqnzUuHGwNpEbBAuvkk%252FkLKfx2Q3TPR54v9mC1Gu0ODimqCZPd68KOPx0iR8Mr9ioL%252F6L14lr7vyWCHNMCxBk5bHwYY7VfMP22XWP&MC_CMP_ESKX=Foi4UD8%2B5vNaHVj6kJTHtw%3D%3D&time=1135100831782" TYPE="text/javascript"></SCRIPT>
<script LANGUAGE="Javascript" SRC="http://sns.cqr.aolmail.aol.co.uk:80/_cqr/xdomain/final.psp?siteId=vatlasaol-gb&MC_CMP_S=diAxLjAga2lkIDIwMDUxMjIwMDIwMDAyMDE5OQ%253D%253D-DPUbTiSz8Gjqv%252FBhcgOKGTr7QnfIKJE58aWoa6lSaU6Zpnrez3fgVA%253D%253D&MC_CMP_ESK=2QLAtVDymNjQCkwW0UxFcg%3D%3D&time=1135100831782" TYPE="text/javascript"></SCRIPT>
<script LANGUAGE="Javascript" TYPE="text/javascript"> 
<!-- 
if (!reachedServer) { 
    snsXDomError(); 
} 
  //--> 
</SCRIPT>
<body onload="checkErrorAndSubmitForm('loginForm', 'true', 'http://aolmail.aol.co.uk/_cqr/login');">  
 <form name="loginForm" method="POST" action="http://aolmail.aol.co.uk/_cqr/login"> 
    <input type="hidden" name="siteId" value="vatlasaol-gb"> 
    <input type="hidden" name="sitedomain" value="vatlasaol-gb"> 
    <input type="hidden" name="authLev" value="2"> 
    <input type="hidden" name="lang" value="en"> 
    <input type="hidden" name="locale" value="gb"> 
    <input type="hidden" name="siteState" value="OrigUrl=http%3a%2f%2fab.aolmail.aol.co.uk%2fmain.adp%3flangid%3d257"> 
</form>
</body>
</html>


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1