curl 模拟post
发布时间:2016-08-15 09:51:19 编辑:龙龙龙 分类:技术文档
function upload_file($url,$filename,$path,$type){
$data = array(
'thumb'=>'@'.realpath($path).";type=".$type.";filename=".$filename
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_getinfo($ch);
$return_data = curl_exec($ch);
curl_close($ch);
echo $return_data;
}
----平淡的流年