我正在使用这个 php 脚本索引一个 pdf 文件。卷曲给我一个错误
curl_error:Protocol "http 在 libcurl 中不受支持或禁用
这是我的代码,请帮助我解决这个错误,我也在谷歌上搜索错误,如果我找到解决方案,我会回复帖子。提前致谢。
$result=move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]);
if ($result == 1) echo "<p>Upload done .</p>";
$options = getopt("f:");
$infile = $options['f'];
$url = "\"http://localhost:8983/solr/update/";
$post_string = file_get_contents("upload/" . $_FILES["file"]["name"]);
$header = array("Content-type:text/xml; charset=utf-8");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
$data = curl_exec($ch);
if (curl_errno($ch)) {
print "curl_error:" . curl_error($ch);
} else {
curl_close($ch);
print "curl exited okay\n";
echo "Data returned...\n";
echo "------------------------------------\n";
echo $data;
echo "------------------------------------\n";
}