I need assistance with setting my headers on PHP file when posting data from ionic APP to PHP processing and save to database.
I have installed Origin Allow and have added the code below in php file.
header(“Access-Control-Allow-Origin: *”);
header(“Access-Control-Allow-Headers: Content-Type, Access-Control-Allow-Headers, X-Requested-With”);
header(“Access-Control-Allow-Headers: Content-Type, application/x-www-form-urlencoded”);
I am still getting the error below
Access to XMLHttpRequest at ‘http://www.btechsolutions/services/register.php’ from origin ‘http://localhost:8100’
has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’
header is present on the requested resource.
Post URL: http://localhost:8100/
Receiving URL https://www.btechsolutions.co.za/services/register.php