• 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

URL.openStream()

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to read the contents of the reverse lookup page from 411.com at
http://www.411.com/10668/search/ReversePhone?phone=8001234567. (Replace 8001234567 with any number.

But anyway, I get a java.io.IOException with the message of
"Server returned HTTP response code: 403 for URL: http://www.411.com/10668/search/ReversePhone?phone=8001234567".

But if you enter the url into your browser it brings up a web page.

Now my question, I'm wondering if anyone has any idea of what I can do to actually get the content of the page?
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried HttpURLConnection?
 
Roger Shields
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, tried both. I can enter most other URLs, like http://www.google.com and it works fine. My best guess is that it is a problem with the user agent or something.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An error code 403 is basically an "access denied" error code. It means that there is something with the request that the site doesn't like. Anyway, I took a quick look... and I guess there is a check to only work for supported browsers. So if you fake it out with something like this:



It seems to work.

Henry
[ January 20, 2007: Message edited by: Henry Wong ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic