在请求中发送秘密值,例如可以在X.com上的脚本中检查的密钥
Y.com:
$secret = 'SECRET_KEY';
X.com:
if(!empty(htmlentities($_POST['secret'])) { if(htmlentities($_POST['secret']) == 'SECRET_KEY') { //Request came from Y.com }}
在请求中发送秘密值,例如可以在X.com上的脚本中检查的密钥
Y.com:
$secret = 'SECRET_KEY';
X.com:
if(!empty(htmlentities($_POST['secret'])) { if(htmlentities($_POST['secret']) == 'SECRET_KEY') { //Request came from Y.com }}