列表到URL参数

I have a bunch of integers which act as ID's within an ArrayList in my Android application.

This list of id's can be of any amount ranging from 0 - x. These id's are to identify players in a match. What I want is to send data to the web service, telling it that players 1,2 and 3 are on team 1 and players 4,5 and 6 are on team 2.

How best can I construct the URL with the above and how do I properly "expect" and "intercept" these parameters on the server side? I am using PHP.

So far I can think of the following:

 $p1 = $_GET['p1'];
 $p2 = $_GET['p2'];
 $p3 = $_GET['p3'];

But as you can probably guess, that's really bad as I don't know how many people will be in team 1 and how many people in team 2. And further...how to seperate them.

Any ideas?

You can do a simple list of players in each teams :

// $_GET['team1'] = '1,2,3';
$team1 = $_GET['team1'];
$team1 = explode(',', $team1);

// $_GET['team2'] = '4,5,6';
$team2 = $_GET['team2'];
$team2 = explode(',', $team2);

Then you have an array per team, containing the players id.

Hope it helped !

EDIT:

Care of query maxlength here is a link :

Please note that PHP setups with the suhosin patch installed will have a default limit of 512 characters for get parameters. Although bad practice, most browsers (including IE) supports URLs up to around 2000 characters, while Apache has a default of 8000.

To add support for long parameters with suhosin, add suhosin.get.max_value_length = in php.ini