NationStates Jolt Archive


UN member lists

Imperial Hubris
31-05-2005, 08:01
Just an idea,

It would make things much easier if there was a was to view only the UN members within your region.

To view a list of only the UN members within a region.
Aeruillin
31-05-2005, 14:15
A PHP script doing that seems the way to go, and it doesn't seem like such a thing would break the rules (http://forums.jolt.co.uk/showpost.php?p=5812823&postcount=59). When it comes to gathering and displaying information automatically without influencing the game, it appears the scripts are only limited by how often they access the server.

Edit: Just some basic idea, crappily formulated:


$s = copy("http://www.nationstates.net/cgi-bin/index.cgi/page=list_region_members/region=".$region."/start=".$pagenumber,"region.txt");
$fp = fopen("region.txt",'r');
$data = fread($fp,filesize('region.txt'));
$start = strpos($data,'<tr><td><a href="nation=');
$end = strpos($data,'</tbody',$start);
$data = explode('<tr><td><a href="nation=',substr($data,$start,$end-$start));
for($j = 1;$j<=15;$j++) {
if(substr_count($data[$j],'alt="UN Member"')==1) {
$length = strpos($data[$j],'"><img');
$name = substr($data[$j],0,$length);
echo '- <a href=http://www.nationstates.net/cgi-bin/index.cgi/page=display_nation/nation='.$name.'>'.$nation.'</a><br />'
}
}


This would result in a list like:

- nation_name1
- test-nation
- test_nation3

displaying all UN nations on that page of the region (without title or capitalization), linking to their nation pages. Of course you'd have to somehow give it the $region name and $pagenumber as parameters. Like so:

somekindofwebspace.com/un-nations.php?region=your-region&page=13
Cape Carnivale
31-05-2005, 15:32
I'm quite sure this did previously exist. Why(/if) it was removed I am unsure.
Cape Carnivale
04-06-2005, 07:34
In fact you'll see that the title of the list of a region's nations will still be: 'UN Member Nations'