Results 1 to 9 of 9
  1. #1
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default openConnection(Proxy proxy) question

    So I'm here working on another sort project trying to understand a couple of things. Does this code connect to the website in a way that if I had a website with a guest counter on it (which I don't or I would try it), then the guest counter number would go up? I assume the answer is yes, but I can't seem to find anything mentioning that this is how it works from Google.

    Java Code:
    myURL.openConnection(Proxy myProxy);
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: openConnection(Proxy proxy) question

    if I had a website with a guest counter on it (which I don't or I would try it), then the guest counter number would go up
    What flavor of guest counter are you referring to? Are you thinking that the openConnection method would issue HTTP GETs for all referenced files like <IMG SRC= etc that are included in the HTML page the URL points to?

  3. #3
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default Re: openConnection(Proxy proxy) question

    Well honestly I don't even know how a guest counter works. All I know about them is that if one is on the page (And is not set to unique visitors only) every time I refresh the page it goes up one.

    I don't think it retrieves any information from the site for the program to use due to the fact that there are more methods under URLConnection that are used to get content.
    Last edited by Dark; 12-29-2011 at 11:45 PM.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: openConnection(Proxy proxy) question

    Can you look at the HTML source for the counter?
    The ones I'm familiar with look like this:

    <i>Viewed </i> <img src="http://<URLHERE>.net/CountHits.php?counter=Ggl_EasyBridge" /><i> times</i>

    The browser does a GET for the image and the PHP code generates an image of the next count.

    Do you have a HTTP server for testing with to see what happens when you connect to a URL.
    There are the big and hairy ones from apache and/or Tomcat.
    Or some simpler ones that will show you what a browser or java program is sending when it opens a URL.
    Last edited by Norm; 12-29-2011 at 11:55 PM.

  5. #5
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default Re: openConnection(Proxy proxy) question

    Well I don't have a counter, I was using it as an example. If a website was listening for something on a page. Say a referral page, the ones where if anyone visits your page you get a perk or something. Like myminicity for example, would openConnection be enough to trigger that? I'm trying to figure out what it does. I'm using the API but that doesn't really give me much example and explanation room to work with.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  6. #6
    ozzyman's Avatar
    ozzyman is offline Senior Member
    Join Date
    Mar 2011
    Location
    London, UK
    Posts
    797
    Blog Entries
    2
    Rep Power
    4

    Default Re: openConnection(Proxy proxy) question

    Im pretty sure it has the same effect as opening a page in a web browser. I made an android app which reads from a database via php server. Accessing the data from android using a HttpRequest would show on the visitor stats. Afterall, the page did get a visit i.e. it was downloaded.

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: openConnection(Proxy proxy) question

    A difference from a browser is whether there are future HTTP GETs for images and other included files.
    The browser will try to everything it needs to display the page, the URLConnection probably won't.

  8. #8
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default Re: openConnection(Proxy proxy) question

    Hmm, so basically the URLConnection will access the webpage file but exclude the images and such? So if something required a certain piece of data, ie a picture to increase the viewed count, this wouldn't trigger it unless I specifically added a few more lines of code to download those extra files?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default Re: openConnection(Proxy proxy) question

    the URLConnection will access the webpage file
    I think it will read the one file. If the contents of the file is markedup (the M in HTML), the program that reads the file has to know what markup is being used so it can parse the file and determine what other files are needed. In HTML a SRC= attribute will refer to another file that is needed.

Similar Threads

  1. proxy server
    By mahamudsust in forum Networking
    Replies: 3
    Last Post: 03-04-2013, 07:04 AM
  2. HTTP and Proxy Help
    By Solarsonic in forum Networking
    Replies: 2
    Last Post: 05-20-2011, 04:50 AM
  3. FindProxyForURL (proxy.PAC) Help
    By rpgowned in forum New To Java
    Replies: 0
    Last Post: 02-11-2011, 04:13 PM
  4. Http - proxy or non-proxy ?
    By Shiv in forum Networking
    Replies: 0
    Last Post: 04-11-2009, 09:07 AM
  5. Proxy or Original...!
    By Shiv in forum New To Java
    Replies: 1
    Last Post: 04-11-2009, 04:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •