Win a copy of Mastering Non-Functional Requirements this week in the Design forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Access website through vpnbook.com  RSS feed

 
parag humane
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on application to access a web page through vpnbook.com.

my code is sending post request to URL "https://webproxy.vpnbook.com/includes/process.php?action=update" with post parameter as "u=yahoo.com&webproxylocation=random"
i am getting response code 302. and HTTP response header contains location "Location=[http://www.vpnbook.com/webproxy]"

But same request was getting correct correct result when opening through web browser.
result contains header response "Location:https://usproxy.vpnbook.com/browse.php?u=DWnjEwVwhlG5GQhW&b=0&f=norefer"

please tell me what is going wrong in my code.




 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36833
481
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some possibilities for why this might be happening:
  • It is a paid service
  • They are checking for a valid session
  • They are checking for certain parameters to be present (like CSRF)
  • They are checking that you are a browser and not a screen scraper


  • Basically, is it allowed to be doing this.
     
    parag humane
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    can you give me solution to do this using java.
    i succeed using web driver but i have to do this without using browser.
     
    Tim Moores
    Saloon Keeper
    Posts: 3654
    78
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    A 302 response is a redirect, which the code doesn't handle. See http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/ for how to go about that.
     
    parag humane
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Tim Moores wrote:A 302 response is a redirect, which the code doesn't handle. See http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/ for how to go about that.


    I know how to handle redirect in java it is not a big deal for me.

    My problem is i am not getting correct response header. i am getting response code 302 that is OK but in response header data, contains
    Location=[http://www.vpnbook.com/webproxy]
    I am expecting response header
    "Location:https://usproxy.vpnbook.com/browse.php?u=DWnjEwVwhlG5GQhW&b=0&f=norefer"

    because when accessing web site from browser i am getting same header response
    "Location:https://usproxy.vpnbook.com/browse.php?u=DWnjEwVwhlG5GQhW&b=0&f=norefer"

    what is way to get above header response?
     
    Dave Tolls
    Ranch Hand
    Posts: 2652
    29
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Have you gone through the dev tools for your browser to see what the sequence of calls is for that page?
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!