Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将cUrl comnad行转换为PHP行_Php_Apache_Ubuntu_Curl - Fatal编程技术网

将cUrl comnad行转换为PHP行

将cUrl comnad行转换为PHP行,php,apache,ubuntu,curl,Php,Apache,Ubuntu,Curl,我有一个curl命令,可以从Linux(ubuntu)命令行成功运行 我需要将这个curl命令合并到PHP脚本中 如何翻译下面的curl命令,使其在PHP脚本中工作 curl -X POST -H "Accept: application/rdf+xml" -F recipe=http://demo/recipe_alta -F input=@prova_rdf.rdf http://site.cs.unibo.it/stanbol/refactor 我在互联网上找到了很多PHP调用,但我总是

我有一个
curl
命令,可以从Linux(ubuntu)命令行成功运行

我需要将这个
curl
命令合并到PHP脚本中

如何翻译下面的curl命令,使其在PHP脚本中工作

curl -X POST -H "Accept: application/rdf+xml" -F recipe=http://demo/recipe_alta -F input=@prova_rdf.rdf http://site.cs.unibo.it/stanbol/refactor
我在互联网上找到了很多PHP调用,但我总是收到http 409和415消息

我也尝试了
exec
shell\u exec
,但我得到了相同的错误

这是另一个调用,只是为了在url上发布rdf文件,我得到了相同的错误

$url = "http://bernina.cs.unibo.it/stanbol/triplestore/grafotest_cavo";
$post_data['file'] = "@prova_rdf.rdf";
$ch = curl_init();
$headers = array('Accept: application/rdf+xml');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
$response = curl_exec($ch);
echo $response;

请显示您尝试过的PHP代码。请阅读PHP手册的curl部分。你会有很多例子阅读上面,我编辑了这篇文章