,卷曲
http://www.php.net/manual/en/ref.curl.php
$curl_handle = curl_init();
if (!$curl_handle) {
die('fail to initialize');
}
curl_setopt($curl_handle, CURLOPT_TIMEOUT, 30);
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 30);
//target URL setup
curl_setopt($curl_handle, CURLOPT_URL, 'https://destination.cm/fg');
//mime type setup, change if necessary
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array("Content-Type: application/xml"));
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_FAILONERROR, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
//here you assign the body of your request
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $xmlVariable);
$response = curl_exec($curl_handle);
if (curl_errno($curl_handle)) {
die(curl_error($curl_handle));
}
printf("Received :\n%s", $response);
这取决于目标预计它的格式。HTTP PUT请求?使用XML作为给定字段名称的值来编码编码数据?还有别的吗? – Quentin 2010-10-01 23:06:48