var auth_mail = "...@gmail.com";
var auth_key = "...B5AC1E...";
var url = "http://seo-builder.ru/api/synonym/";
$.ajax(
{
url: url,
type: 'get',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': "*"
},
data: {
auth_key: auth_key,
auth_mail: auth_mail,
text: text
},
dataType: 'json',
success: function (result) {
console.log(result);
},
error: function (error) {
console.log(error);
}
});
Access to XMLHttpRequest at 'http://seo-builder.ru/api/synonym/?auth_key=...' from origin 'http://pars.spr.local' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
header('Access-Control-Allow-Origin: *');
<?php
$tmp = array(
'auth_mail' => "...@gmail.com",
'auth_key' => "...B5AC1E...",
'text' => $_REQUEST['text'],
);
if(stristr($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])) readfile("http://seo-builder.ru/api/synonym/?".http_build_query($tmp));
?>