public static function create_folder_resource($project_url, $ticket, $path, $label)
{
$url = fix_parse_url($project_url);
$url = parse_url($project_url);
$label = trim(str_replace('/', '', $label));
$response = SimpleHTTP::send('POST', $url['host'], $url['port'], $url['path'], array('a' => 'create_folder_resource', 'ticket' => $ticket, 'path' => $path, 'label' => $label));
if ('200' != $response['status_code']) {
throw new Exception("Invalid status code `{$response['status_code']}' returned from server `{$url['host']}'.");
}
$content = trim($response['body']);
if ('' === $content) {
throw new Exception("Unable to create project folder resource, no content returned from `{$url['host']}{$url['path']}'.");
}
if (false !== strpos($response['headers']['content-type'], 'text/xml')) {
return array('flush' => true, 'content' => $content);
}
if ('#S#' != substr($content, 0, 3)) {
throw new Exception("Error while creating project folder resource: Message from {$url['host']}{$url['path']}: " . substr($content, 3));
}
return array('flush' => false, 'content' => substr($content, 3));
}