在使用Curl发布xml时获得权限拒绝


Getting permission denied while Posting xml using Curl?

我必须将xml发布到url以供某些web服务使用。我使用的是CentOS 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。任何想法为什么我得到这个从代码,而能够从CLI使用curl -d访问url。

我的问题解决了

setsebool -P httpd_can_network_connect 1