① curl上传文件
<?php $postData=array(
'name'=>'123',
'upload'=>'@E:/wamp/www/function/result.zip'
);
$ch= curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/function/upload.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$result= curl_exec($ch);
$error= curl_getinfo($ch);
curl_close($ch);
//print_r($error);
var_dump($result);
?>
② curl发送xml信息
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type:text/xml;charset=utf-8'));