• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Access website through vpnbook.com

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.




 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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.
     
    Saloon Keeper
    Posts: 7590
    177
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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?
     
    Rancher
    Posts: 4801
    50
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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?
    reply
      Bookmark Topic Watch Topic
    • New Topic