我必须将xml发布到某个网站服务所使用的网址。我使用的是Cent OS 5.6 Apache / 2.2.3(CentOS)。当我使用curl-d@"abc.xml" http://example.com
从命令行发布时它给了我结果。但是当我使用curl从php发布时
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
它给我卷曲错误permission denied
。知道为什么我从代码中获取此代码,同时能够使用curl -d
从CLI访问URL。在此先感谢
答案 0 :(得分:4)
setsebool -P httpd_can_network_connect 1解决我的问题