I have two websites use Drupal.
In Websites ONE: I have code
$data = array(
'key1' => 'value1',
'key2' => 'value2',
);
$request = array(
'headers' => array(
'Content-Type' => 'application/json',
'Accept' => 'application/json',
),
'data' => drupal_json_encode($data),
'method' => 'POST',
'max_redirects' => 3,
// We set a lower timeout since we don't want the user waiting for the page too long
'timeout' => 30,
);
$url = 'http://examplesitetwo.com/return-data';
$response = drupal_http_request($url, $request);
In Website TWO: i have code
function my_module_menu() {
$items = array();
$items['return-data'] = array(
'page callback' => 'return_data_pcb',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function return_data_pcb() {
// How to get post data form drupal_http_request in website one;
}
How to get post data form drupal_http_request() in website one? Thank you!