Search code snippets, questions, articles...

Allow CORS in PHP

    header("Access-Control-Allow-Origin: *");

If you are getting CORS error in your console while making an HTTP request to a PHP file, you can add above code in your file. This will allow all domains to make an HTTP request with your domain.

Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet