I have this jquery code
$.post('data.php'{"request":"data_"+$(this).attr("data")},function(data){
$("div").text(data);
});
But if somebody else can call my website like this
$.ajax({
url: 'http://www.website.com/data.php',
data: { request: "data_1" },
success: function(data) {
alert(data);
}
He can easily get mine data.
How prevent this?
browsers won’t let cross domain requests happen.
regarding serverside scraping there’s not much you can do, you could check to allow only browser’s user agents but ultimately anything can be faked with the right tools (it’s just an http request at the end of the day).
Of course if you notice spike in traffic from certain hosts you can disable access from those.
If you want to prevent framing you can add
to htaccess