I only want to allow requests from my website to visit the following php page. However all pages are being allowed on XAMPP.
This is my code:
I'm using a .js file to call the php file:
// page1.js
var json_url = "page2.php";
$.getJSON(json_url, function(response) {
alert("Entered");
});
And on page2.php :
<?php
header("Access-Control-Allow-Origin: https://www.mywebsite.com");
header("Access-Control-Allow-Credentials: true");
header("Content-Type: application/json");
// ...
?>