ens0mx
ens0mx

Reputation: 9

how to enable CORS with phpmyAdmin and ionic 3?

I want to send the form data that I filled out to the master user in phpmyadmin, but when I fill out and submit a submit, I receive that old error, I'm sorry for the English, I'm Brazilian, I've already searched in several places, nothing that would make me understand and make it work, can anyone help me?

Upvotes: 0

Views: 962

Answers (1)

user9088454
user9088454

Reputation: 1122

Just add this on top of the retrive.php file,

<?php
  header("Access-Control-Allow-Origin: *"); 
  header('Access-Control-Allow-Origin: http://localhost', false); 
  echo 'Hello World';
?>

In the PHP code above, I am telling the browser that http://localhost has permission to make cross-domain requests to my website. The second parameter of PHP’s header function has been set to FALSE so that it is not overwritten by any other Access-Control-Allow-Origin headers that we may add in the future.

Reference page: CORS on PHP

Upvotes: 1

Related Questions