磐多拉反欺詐對接

		$data = input('post.');
			$param = array('name'=>$data['name'],'id_card_no'=>$data['id_card_no'],'mobile'=>$data['mobile']);
			$param_json = json_encode($data);
			$app_url = 'https://api.dpandora.cn/service/anti_fraud';
			$authorization_token = '53-dxxxxxxxxxxxxxxxxxxx';
			$ch = curl_init();  
			curl_setopt($ch, CURLOPT_POST, 1);
			curl_setopt($ch, CURLOPT_URL, $app_url);
			curl_setopt($ch, CURLOPT_POSTFIELDS, $param_json);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt($ch, CURLOPT_TIMEOUT, 30);  
			curl_setopt($ch, CURLOPT_HTTPHEADER, array(
					'Access-Control-Allow-Origin:*',
					'Content-Type: application/json; charset=utf-8',
					'Content-Length: ' . strlen($param_json),
					'Authorization: '.$authorization_token
				)  
			);  
			$response = curl_exec($ch);  
			$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
			//echo curl_error($ch);  
			curl_close($ch);  
			if($httpCode == 200){
				$data['status'] = 1;//請求成功
				$data['content'] = preg_replace_callback("#\\\u([0-9a-f]+)#i", function ($match){  
					return iconv('UCS-2', 'UTF-8', pack('H4', $match[1]));  
				}, $response);
				$data['add_time'] = NOW_TIME;
				$this->blacklist_db->insert($data);
				return $data= ['result_code'=>1,'datas'=>$response];
			}else{
				return $data= ['result_code'=>0];
			}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章