Hi Guys,

could you help me to post json parameter on the server like bellow or convert to java from php code
{"method":"getData","params":["xxxx123"],"id":2}

on php i have created the code

like

PHP Code:
<?php
 
 
$postData = array(
    
                'method'=>'getData',
                'params'=>array('xxxx123'),
                'id'=>3
        

);
//	$strParams='';
//                foreach ($postData as $k=>$v)
//		{
//			$strParams.=urlencode($k).'='.urlencode($v).'&';
//		}
//
//			$strParams=substr($strParams,0,-1);
#echo $strParams;
// Setup cURL
$ch = curl_init('http://xxx.com/json-server.php');
curl_setopt_array($ch, array(
    CURLOPT_POST => FALSE,
    CURLOPT_RETURNTRANSFER => TRUE,
    CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json'
        
    ),
    CURLOPT_POSTFIELDS => json_encode($postData)
));

// Send the request
$response = curl_exec($ch);

// Check for errors
if($response === FALSE){
    die(curl_error($ch));
}
//var_dump($response);

// Decode the response
$responseData = json_decode($response, TRUE);

 print_r($responseData);
thanks