我正在尝试从我的localhost发送一个cURL发布请求,但我收到了Missing参数错误 . 当我尝试从REST客户端mozilla插件时它工作正常 . 下面是我的PHP代码 .

$file = tempnam(sys_get_temp_dir(), 'AMZREO');
$fh = @fopen($file, 'w+');
foreach($input as $curl_response)
{
   fputcsv($fh, $curl_response, ',', '"');
}
// ... close the "file"...
@fclose($fh);
$post = array(
            'file'=>'@'.$file
        );
print_r($post);
$header[] = 'Authorization: Token '.$token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$target_url.'?target='.$target);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);    
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLOPT_HTTP200ALIASES, array(400, 500));
$response = curl_exec($ch);

以下是回复

print_r($response);
{"status": "Failure", "message": "Missing Parameters"}

我能够在我的临时文件夹中看到创建的文件 . 当我print_r $ post数组时,我得到了这个结果 .

Array
(
    [file] => @C:\Users\acer\AppData\Local\Temp\AMZEE93.tmp
)

请在这方面帮助我 . 非常感谢任何帮助 .