I have to post a xml to a url to be consumed by some web service. I am using Cent OS 5.6 Apache/2.2.3 (CentOS). When I post from command line using curl-d@"abc.xml" http://example.com
It gives me result. But when I post from php using curl
$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);
It gives me curl error permission denied
. Any idea why I am getting this from code while able to access the url from CLI using curl -d
. Thanks in Advance