Send JSONArray from android to php -


i transferred jsonarray android app php file , when echo on php file echo's "array" can't seem access contents of array.

here part of php file:

$data = json_decode(file_get_contents('php://input'), true);  $orderjson = urldecode($_post['order']); $orderjson = json_decode($orderjson,true);  // create connection $conn = mysqli_connect($servername, $username, $password2, $dbname); // check connection if (!$conn) {     die("connection failed: " . mysqli_connect_error()); }  echo $orderjson; 

i cant seem access contents, return null, used following encode jsonarray on android.

string jsonpost = urlencoder.encode("order","utf-8")+"="+urlencoder.encode(jsonarray.tostring(),"utf-8"); 

i have double check if array has data before posting through , display loaded contents, on php file echo's contents when comment out json_decode() method

$orderjson array , cannot use echo show contents of array in php. use print_r($orderjson); instead.

about how access data in array please refer to: http://php.net/manual/en/language.types.array.php


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -