Saturday, 16 August 2014

Getting permission denied while Posting xml using Curl?



I have to post xml to url for consuming 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


No comments:

Post a Comment