My code is like this but its not coming in desc order ?
<?php
error_reporting(E_ALL);
// specify the REST web service to interact with
$url = 'localhost/suitecrm7.1.1/service/v4_1/rest.php';
// Open a curl session for making the call
$curl = curl_init($url);
// Tell curl to use HTTP POST
curl_setopt($curl, CURLOPT_POST, true);
// Tell curl not to return headers, but do return the response
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Set the POST arguments to pass to the Sugar server
$parameters = array(
'user_auth' => array(
'user_name' => 'admin',
'password' => md5('admin'),
),
);
$json = json_encode($parameters);
$postArgs = array(
'method' => 'login',
'input_type' => 'JSON',
'response_type' => 'JSON',
'rest_data' => $json,
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
// Make the REST call, returning the result
$response = curl_exec($curl);
// Convert the result from JSON format to a PHP array
$result = json_decode($response);
echo "
";
print_r($result);
if ( !is_object($result) ) {
die("Error handling result.\n");
}
if ( !isset($result->id) ) {
die("Error: {$result->name} - {$result->description}\n.");
}
// Echo out the session id
echo $result->id." ";
$session = $result->id;
// Let us fetch detail of a Payment
$fields_array = array('name','amount','date_entered');
$parameters = array(
'session' => $session, //Session ID
'module_name' => 'p_payment', //Module name
'query' => " p_payment.name IS NOT NULL ", //Where condition without "where" keyword
'order_by' => " p_payment.date_enterded ", //$order_by
'offset' => 0, //offset
'select_fields' => $fields_array, //select_fields
'link_name_to_fields_array' => array(array()),//optional
'max_results' => 10, //max results
'deleted' => 'false', //deleted
);
$json = json_encode($parameters);
print_r($json);
$postArgs = array(
'method' => 'get_entry_list',
'input_type' => 'JSON',
'response_type' => 'JSON',
'rest_data' => $json,
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
$response = curl_exec($curl);
// print_r($response);
// Convert the result from JSON format to a PHP array
$result = json_decode($response);
print "