aspose file tools
The moose likes Java in General and the fly likes Problem with URLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Problem with URLConnection" Watch "Problem with URLConnection" New topic
Author

Problem with URLConnection

Thai C. Tran
Greenhorn

Joined: Jul 05, 2009
Posts: 26
Hi all,

I am trying java networking programming, just for fun during my summer time. i try to connect to a website using java. To test the whether the code actually connect to a website, i put a page view counter in my blog and used the code to connect to it. However, page view counter doesn not increase when the program finishes. Can you give me some suggestions, please? This is my code


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

What type of page counter have you used? One with Netstat or a similar service?

If so, then those only work if its image is loaded, with the special code in the src tag indicating that it is your site for which the counter is loaded. You should parse the HTML page (HTMlEditorKit.Parser and HTMLEditorKit.ParserCallback may help you out), retrieve the image source and read its data as well.

If the counter is something custom written in PHP / ASP / JSP / servlets / CGI then just accessing the page should work. That should also work if you're using a counter based on the webserver's logs like Webalizer.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Thai C. Tran
Greenhorn

Joined: Jul 05, 2009
Posts: 26
got it. Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with URLConnection
 
Similar Threads
Performance Issue: HttpURLConnection
JSException.
Java cookies ?
servlet to servlet communication from two different servers
JUnit testing HttpURLConnection