支付宝支付开发的防钓鱼的时代已经到来
跳转到支付页面后,支付宝的收银台提示:
支付存在钓鱼风险
错误吗:ae130001040
找到了相应页面:https://cshall.alipay.com/enterprise/help_detail.htm?help_id=474059
在发起支付页面跳转的地方,增加参数“anti_phishing_key”,赋值为
'anti_phishing_key' => urlencode($this->query_timestamp()),
/** * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数 * 注意:该功能php5环境及以上支持,因此必须服务器、本地电脑中装有支持domdocument、ssl的php配置环境。建议本地调试时使用php开发软件 * return 时间戳字符串 */ private function query_timestamp($partner) { $url = $this->gateway_new . service=query_timestamp&partner= . trim(strtolower($partner) . &_input_charset= . trim(strtolower('utf-8')); $encrypt_key = ; $doc = new domdocument(); $doc->load($url); $itemencrypt_key = $doc->getelementsbytagname(encrypt_key); $encrypt_key = $itemencrypt_key->item(0)->nodevalue; return $encrypt_key; }