I have two virtual hosts, xyz.com and abc.com. From xyz.com I’m making curl post call(using PHP) to http://abc.com/test
This returns me “403 Error – Forbidden” (http://abc.com/test works fine in browser)
I know this questions sounds quite repeating one. Sorry about that, as I have went through all the solutions given in previous answers, nothing works 🙁
- My root folders (doc root) in Apache, have 775 permissions.
-
In httpd.conf my controls are as follows
Options FollowSymLinks AllowOverride All Order allow,deny Allow from all - I have also tried adding USERAGENT (of firefox) in code to emulate browser.
I’m not getting whats the exact problem here with Apache. I’m using Apache 2.4
Can some please work out to help on this?
UPDATED
Below is code which I’m using for sending request.
$curl = curl_init();
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
curl_setopt($curl, CURLOPT_URL, 'http://abc.com/test');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, 'a=b&c=d&e=f');
$headers[] = 'Content-Type:application/x-www-form-urlencoded';
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
Ahh, its solved. Just changed:
to: