Acces from Java


(317070) #1

Hello, I am developing a java-project which is able to ‘crawl’ through the internet. I would however like to count how many times my application is used (and by who/where/when…) and since I am already on sourceforge I thought, “why not use piwik?”.

I’ve already went through your javascripts, and I tried to run it from java (with a javascript-engine), but I had a few problems.

If I’m not mistaking, piwik counts by counting how many times a certain php-page has been opened, where the URL contains the extra information. I tried to go through the script, but since java can’t give through a ‘document’ and such (e.g. document.writeln(***)) huge chuncks of scriptingcode had to be altered. At the moment, I couldn’t get it to work…

If this is the case (the program actually counts by such a php-url), could you supply some information on how to create this URL with which tags (those &url=’…’ things) so I could acces the counting mechanism through Java? Or do you know another way to count from Java-code?

I am very eager to hear the answer,

grtz,

317070


(317070) #2

[quote=317070 @ May 29 2009, 09:42 PM]Hello, I am developing a java-project which is able to ‘crawl’ through the internet. I would however like to count how many times my application is used (and by who/where/when…) and since I am already on sourceforge I thought, “why not use piwik?”.

I’ve already went through your javascripts, and I tried to run it from java (with a javascript-engine), but I had a few problems.

If I’m not mistaking, piwik counts by counting how many times a certain php-page has been opened, where the URL contains the extra information. I tried to go through the script, but since java can’t give through a ‘document’ and such (e.g. document.writeln(***)) huge chuncks of scriptingcode had to be altered. At the moment, I couldn’t get it to work…

If this is the case (the program actually counts by such a php-url), could you supply some information on how to create this URL with which tags (those &url=’…’ things) so I could acces the counting mechanism through Java? Or do you know another way to count from Java-code?

I am very eager to hear the answer,

grtz,

317070[/quote]
I have worked out the URL, but after several tries, it appears Piwik keeps on giving me the html 500 error code. Is this a known issue, or is this deliberately?

The URL I try to access is: “http://apps.sourceforge.net/piwik/lyricscatcher/piwik.php?url=http%3A%2F%2Flyricscatcher.sourceforge.net%2Fpiwik.php&action_name=&idsite=1&res=1440x900&h=20&m=38&s=51&fla=1&dir=1&qt=1&realp=1&pdf=1&wma=1&java=1&cookie=0&title=JAVAACCESS&urlref=http%3A%2F%2Flyricscatcher.sourceforge.net%2Fcomputeraccespage.html

java.io.IOException: Server returned HTTP response code: 500 for URL: http://apps.sourceforge.net/piwik…%2fcom…raccespage.html

The URL is working when I access it from my browser, and Piwik will count 1 visitor after accessing the URL from my browser.

I hope this issue is solvable…

Yours sincerely,

Jonas


(kolchak) #3

A 500 error is not standard. I’m confused tho why you are getting a Java error when the script is a PHP script?


(317070) #4

I’m building a Java-application for which I would like to get a bit of information from my users (just like website-developpers do, I would like to know which version of Java they are using, what screen size,…). I try to do this with piwik as piwik has a server who counts how many times a specific image has been loaded into the webpage (through indeed a php script) This image can be found on the link earlier in this topic, and this URL contains all/most information the server stores. So when I load this image from Java, the server stores the information my Java-program provided, and I can then later see this information of the users of my program the same way everybody else does.

When I access this php-page through Java, I receive this http-500 error, which in Java is a special kind of IOException. In my browser(s) the link is working fine though. Also other php-pages tend to work fine in Java (e.g. the search engines of youtube, gracenote, …).

So I presume the php-script is requesting some extra information of the visitor (but as php runs on server, I don’t know whether this is possible?) which it doesn’t get, as the request didn’t came from a regular browser, and therefore crashes, returning the http-500 internal server error.

I am a complete noob in php, but I presume this should normally never happen, since the same error might be given in newer or exotic browsers.

Yours sincerely,

Jonas