Example #1
0
	public function verifygw() {
		$biz_content = HttpRequest::getRequest ( "biz_content" );
		$as = new AlipaySign ();
		$xml = simplexml_load_string ( $biz_content );
		// print_r($xml);
		$EventType = ( string ) $xml->EventType;
		// echo $EventType;
		if ($EventType == "verifygw") {
			require 'config.php';
			// global $config;
			// print_r ( $config );
			$response_xml = "<success>true</success><biz_content>" . $as->getPublicKeyStr($config ['merchant_public_key_file']) . "</biz_content>";
			// echo $response_xml;
			$return_xml = $as->sign_response ( $response_xml, $config ['charset'], $config ['merchant_private_key_file'] );
			file_put_contents ( "log.txt", $return_xml, FILE_APPEND );
			echo $return_xml;
			exit ();
		}
	}
Example #2
0
 public function verifygw($is_sign_success, $merchant_public_key_file, $merchant_private_key_file, $charset)
 {
     $biz_content = HttpRequest::getRequest("biz_content");
     $as = new AlipaySign();
     $xml = simplexml_load_string($biz_content);
     // print_r($xml);
     $EventType = (string) $xml->EventType;
     // echo $EventType;
     if ($EventType == "verifygw") {
         if ($is_sign_success) {
             $response_xml = "<success>true</success><biz_content>" . $as->getPublicKeyStr($merchant_public_key_file) . "</biz_content>";
         } else {
             // echo $response_xml;
             $response_xml = "<success>false</success><error_code>VERIFY_FAILED</error_code><biz_content>" . $as->getPublicKeyStr($merchant_public_key_file) . "</biz_content>";
         }
         $return_xml = $as->sign_response($response_xml, $charset, $merchant_private_key_file);
         writeLog("response_xml: " . $return_xml);
         echo $return_xml;
         exit;
     }
 }
Example #3
0
 public function mkAckMsg($toUserId)
 {
     global $_GP;
     $as = new AlipaySign();
     $response_xml = "<XML><ToUserId><![CDATA[" . $toUserId . "]]></ToUserId><AppId><![CDATA[" . $_GP['alipay_config']['app_id'] . "]]></AppId><CreateTime>" . time() . "</CreateTime><MsgType><![CDATA[ack]]></MsgType></XML>";
     $return_xml = $as->sign_response($response_xml, $_GP['alipay_config']['charset'], $_GP['alipay_config']['merchant_private_key_file']);
     return $return_xml;
 }
Example #4
0
 function mkAckMsg($toUserId)
 {
     $as = new AlipaySign();
     require 'config.php';
     $response_xml = "<XML><ToUserId><![CDATA[" . $toUserId . "]]></ToUserId><AppId><![CDATA[" . $config['app_id'] . "]]></AppId><CreateTime>" . time() . "</CreateTime><MsgType><![CDATA[ack]]></MsgType></XML>";
     $return_xml = $as->sign_response($response_xml, $config['charset'], $config['merchant_private_key_file']);
     writeLog("response_xml: " . $return_xml);
     return $return_xml;
 }