'UNAUTHORIZED', 'message' => 'Unauthorized Access!'))); } if (isset($_POST['itemID']) && !empty($_POST['itemID']) && isset($_POST['nodeOperation'])) { $biblioIDS = ''; // concat all ID if (is_array($_POST['itemID'])) { foreach ($_POST['itemID'] as $itemID) { $biblioID = (integer)$itemID; $biblioIDS .= $biblioID.','; } // remove last comma $biblioIDS = substr_replace($biblioIDS, '', -1); } else { $biblioIDS = (integer)$_POST['itemID']; } // node data if ($_POST['nodeOperation'] == 'delete') { $data = array( 'operation' => 'delete', 'biblio' => $biblioIDS ); } // encode array to json format $to_sent['node_info'] = $node; $to_sent['node_data'] = $data; // create HTTP request $http_request = new http_request(); // send HTTP POST request $server_addr = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : (isset($_SERVER['LOCAL_ADDR']) ? $_SERVER['LOCAL_ADDR'] : gethostbyname($_SERVER['SERVER_NAME'])); $http_request->send_http_request($ucs['serveraddr'].'/uc-ops.php', $server_addr, $to_sent, 'POST', 'text/json'); // below is for debugging purpose only // die(json_encode(array('status' => 'RAW', 'message' => $http_request->body()))); // check for http request error if ($req_error = $http_request->error()) { die(json_encode(array('status' => 'HTTP_REQUEST_ERROR', 'message' => $req_error['message']))); } // print out body of request result echo $http_request->body(); exit(); } else { die(json_encode(array('status' => 'NO_BIBLIO_SELECTED', 'message' => 'Please select bibliographic data to update!'))); }