2010-11-03 63 views
0

我一直得到400.我的哈德森服务器上没有启用安全性。Hudson:使用php curl发布config.xml?

<?php 

$url = "http://myhudsonserverIP/createItem?name=NEWJOB"; 

$post_string = file_get_contents("config.xml"); 


$header = "POST HTTP/1.0 \r\n"; 
$header .= "Content-type: text/xml \r\n"; 
$header .= "Content-length: ".strlen($post_string)." \r\n"; 
$header .= "Content-transfer-encoding: text \r\n"; 
$header .= "Connection: close \r\n\r\n"; 
$header .= $post_string; 

$ch = curl_init(); 
curl_setopt($ch, CURLOPT_HEADER, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
curl_setopt($ch, CURLOPT_URL,$url); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_TIMEOUT, 4); 
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); 

$data = curl_exec($ch); 

//DUMP OUT HEADER 
echo var_dump($data); 

?> 

回答

1

你必须添加一个查询参数,你想创建configuration

URL /.../ createItem?名=项目名

+0

仍然得到400。 – KJW 2010-11-03 22:01:49