<?php 
function ali_inquiry($id,$PrivateKey,$PublicKey,$in_id){
	require_once('./aop/AopSdk.php');
	$aop = new AopClient ();
	$aop->appId = $id;
	$aop->rsaPrivateKey = $PrivateKey;
	$aop->alipayrsaPublicKey=$PublicKey;
	$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
	$aop->apiVersion = '1.0';
	$aop->signType = 'RSA2';
	$aop->postCharset='utf-8';
	$aop->format='json';
	$date=date("YmdHis");
	$request = new AlipayTradeQueryRequest ();
	$request->setBizContent("{" .
"\"out_trade_no\":\"".$in_id."\"," .
"\"trade_no\":\"\"" .
"  }");
	$result = $aop->execute ( $request); 
	$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
	$resultCode = $result->$responseNode->code;
	if(!empty($resultCode)&&$resultCode == 10000){
		if($result->alipay_trade_query_response->trade_status=='TRADE_SUCCESS'){
			return true;
		}
	} 
	return false;
}




?>