我正在尝试使用http://nlp.stanford.edu:8080/corenlp/process上的表格以编程方式处理我的陈述。我在 PHP/CURL 中有以下代码片段。但是,它不是处理语句,而是返回表单的 HTML - 就好像没有发送 post 参数一样。我检查了我是否发送了所需的参数。有人可以指导我做错什么吗?
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://nlp.stanford.edu:8080/corenlp/process");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT,"Mozilla/14.0 (compatible; MSIE 6.0; Windows NT 5.1)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POST, true);
$data = array(
'outputFormat' => 'xml',
'input' => 'Here is a statement to process',
'Process' => 'Submit Query'
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
echo $result;