function background_process_dispatcher_http in Background Process 7.2
Dispatcher for HTTP
1 string reference to 'background_process_dispatcher_http'
- background_process_background_process_dispatcher_info in ./
background_process.module - Implements background_process_dispatcher_info().
File
- ./
background_process.dispatchers.inc, line 6
Code
function background_process_dispatcher_http($process) {
$process
->logDebug(__FUNCTION__);
list($url, $headers) = background_process_build_request('bgp-start/' . $process
->getPID(), $process
->getServiceHost(), array(
'query' => array(
'handle' => $process
->getHandle(),
),
));
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
$data = 'token=' . $process
->getToken();
if ($process
->getPhase()) {
$data .= '&process=' . base64_encode(serialize($process));
$data .= '&module=' . base64_encode(drupal_get_path('module', 'background_process'));
$data .= '&DRUPAL_ROOT=' . base64_encode(DRUPAL_ROOT);
$url = url(drupal_get_path('module', 'background_process') . '/background_process.bootstrap.php', array(
'query' => array(
'handle' => $process
->getHandle(),
),
'absolute' => TRUE,
));
}
$options = array(
'method' => 'POST',
'data' => $data,
'headers' => $headers,
'blocking' => FALSE,
);
$result = background_process_http_request($url, $options);
$process->connection = $result->fp;
}