Jump to content

Talk:Rosetta Code/Rank languages by popularity: Difference between revisions

403 Problem
(→‎wanted: a complete list: added a comment about enhancing the REXX program to include another total (# of languages).)
(403 Problem)
Line 533:
 
:::Many are coding using the API to retrieve the data as it accurately reflects language popularity which is the title of the task and obvious intention of the creator who has not posted on RC since 2010. That doesn't mean those who code using Special:Category are wrong thus there is room to do it both ways should you choose to follow a literal interpretation. -- [[User:3havj7t3nps8z8wij3g9|3havj7t3nps8z8wij3g9]] ([[User talk:3havj7t3nps8z8wij3g9|talk]]) 04:26, 28 May 2015 (UTC)
 
==Accessing RC via Java==
 
I'm trying to solve this in Java - the "obvious" Java code:
 
<pre>
String path = "http://www.rosettacode.org"
+ "/mw/api.php"
+ "?action=query"
+ "&generator=categorymembers"
+ "&gcmtitle=Category:Programming%20Languages"
+ "&gcmlimit=500"
+ ( gcmcontinue ? ( "&gcmcontinue=" + gcmcontinue ) : "" )
+ "&prop=categoryinfo"
+ "&format=txt"
;
URL url = new URL( path );
 
Object content = url.getContent();
 
</pre>
 
gets a 403 (Forbidden) response.
I found a question on Stack Overflow (related to another RC task) that suggested setting the http Agent property of the connection. Is this necessary? I don't see anything like this in the other languages solutions?
 
[[User:Tigerofdarkness]]
3,049

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.