我正在尝试使用位于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;