php

Allow CORS in PHP

<?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?