• 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 Connection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the URL for a site that will send a page. When I type the URL into a new browser and press enter, the page is sent.
I am trying to do this now with my java program.
I have done the following, but the page is not sent:
URL url = new URL("http://myurl");

URLConnection connection = url.openConnection();
connection.connect();
Does anyone have any ideas what I am doing wrong?
THanks!
 
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I presume this is not the entire program -- can you show us more, and tell us how it is not working properly?
 
lisa m
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess that's part of my question.
There is currently an existing site that will send a page message. I have the URL for this site. When I type this URL into a browser, a page is sent to my pager.
I would like to replicate this and have my code connect to this same URL so that the page will be sent to my pager.
I thought all I needed to do was to use the URLConnection class to connect to the URL. I don't need to read anything from the site. Is there something else that I should be doing besides just connecting to that site?
 
lisa m
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, I guess I forgot to mention that I know the connection is successful.
I am getting a responseCode of 200, which I believe means that the Connection succeeded.
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any place where you're actually reading the content of the page. (And doesn't this program receive a web page, not send one?)
 
reply
    Bookmark Topic Watch Topic
  • New Topic