Example #1
0
 public function api()
 {
     require_once FUWU_PATH . 'aop/AopClient.php';
     require_once FUWU_PATH . 'HttpRequst.php';
     $serviceType = HttpRequest::getRequest('service');
     $biz_content = HttpRequest::getRequest('biz_content');
     switch ($serviceType) {
         case 'alipay.service.check':
             $success = '<success>true</success>';
             $biz_content = '<biz_content>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDVwtjFJVYyf4/sZY+GE3FSeLx7RyOmt+KoWnLi9XsRpQdaXRd+X7mO8kr8Yw6KN9TwgZV8o7iVi3OsuuCD/hgua4Go2oyIWG/NjcaqM3nXOYripfV+BlOdslKBVyAhY6SNuavLt97CVpAe2bIcZH/heNQnHoMQtb/X+KoC6kwouQIDAQAB</biz_content>';
             $tmpArr = array($biz_content, $success);
             $aop = new AopClient();
             $sign = $aop->rsaSign($tmpArr);
             $xmlTmp = '<?xml version="1.0" encoding="GBK"?><alipay><response><success>true</success>' . $biz_content . '</response><sign>' . $sign . '</sign><sign_type>RSA</sign_type></alipay>';
             echo $xmlTmp;
             break;
         case 'alipay.mobile.public.message.notify':
             require_once FUWU_PATH . 'Message.php';
             $post = file_get_contents('php://input');
             $str = urldecode($post);
             $arr = explode('&', $str);
             $arr = explode('=', $arr[1]);
             $msg = new Message($arr[1], $this->FuwuToken);
             break;
     }
 }
Example #2
0
 public function sendRequest($biz_content)
 {
     $custom_send = new AlipayMobilePublicMessageCustomSendRequest();
     $custom_send->setBizContent($biz_content);
     require FUWU_PATH . 'config.php';
     $aop = new AopClient();
     $aop->appId = FUWU_APPID;
     $aop->rsaPrivateKeyFilePath = $config['merchant_private_key_file'];
     $result = $aop->execute($custom_send);
     return $result;
 }
 public function getAlipayMobilePublicMessagePushRequest($bizcontent)
 {
     $c = new AopClient();
     $c->appId = self::appId;
     $c->rsaPrivateKeyFilePath = dirname(__FILE__) . self::rsaPrivateKeyFilePath;
     $c->format = 'json';
     $req = new AlipayMobilePublicMessagePushRequest();
     $req->setBizContent($bizcontent);
     $resp = $c->execute($req);
     return $resp;
 }
Example #4
0
/**
 * 使用SDK执行接口请求
 * @param unknown $request
 * @param string $token
 * @return Ambigous <boolean, mixed>
 */
function aopclient_request_execute($request, $token = NULL)
{
    require 'config.php';
    $aop = new AopClient();
    $aop->gatewayUrl = $config['gatewayUrl'];
    $aop->appId = $config['app_id'];
    $aop->rsaPrivateKeyFilePath = $config['merchant_private_key_file'];
    $aop->apiVersion = "1.0";
    $result = $aop->execute($request, $token);
    writeLog("response: " . var_export($result, true));
    return $result;
}