0

I want to pass an array parameter in http request.I don't know if it can work. And If i can do it,How to do? Thanks.

Bhoomika Brahmbhatt
  • 7,404
  • 3
  • 29
  • 44
  • you can use json or xml for this. check out these links they may help you http://developer.appcelerator.com/question/136900/httpclient-post-and-json-including-array https://stackoverflow.com/questions/13093628/passing-array-of-objects-as-url-parameters-in-request https://stackoverflow.com/questions/2009707/sending-a-serialized-object-from-android-to-a-servlet-using-http-client – Bharadwaja Bapatla May 22 '14 at 04:08

1 Answers1

1

alternative simple version, use String with unique dividers(or delimiters, whatever) in java(android),
pass it and explode the string in php to array.


ex:

String toBePassed = "VAR1||VAR2||VAR3||VAR4";

and in php you can explode it like this

$var  = $_GET('toBePassed'); // "VAR1||VAR2||VAR3||VAR4"
$varpiece = explode("||", $var);
echo $varpiece[0]; // VAR1
echo $varpiece[1]; // VAR2
echo $varpiece[2]; // VAR3
echo $varpiece[3]; // VAR4
Ferry Tan
  • 218
  • 2
  • 10