当前位置: 首页>>代码示例>>PHP>>正文


PHP HttpRequest::sendPostRequst方法代码示例

本文整理汇总了PHP中HttpRequest::sendPostRequst方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpRequest::sendPostRequst方法的具体用法?PHP HttpRequest::sendPostRequst怎么用?PHP HttpRequest::sendPostRequst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HttpRequest的用法示例。


在下文中一共展示了HttpRequest::sendPostRequst方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index($token)
 {
     $app_id = M('Wxuser')->where(array('token' => $token))->getField('fuwuappid');
     if ($_GET['auth_code'] == '') {
         $redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $api_url = 'https://openauth.alipay.com/oauth2/publicAppAuthorize.htm?app_id=' . $app_id . '&auth_skip=false&scope=auth_userinfo,auth_contact&redirect_uri=' . urlencode($redirect_uri);
         echo '<script>window.location.href=\'' . $api_url . '\'</script>';
     } else {
         $auth_code = $_GET['auth_code'];
         $fuwuurl = 'https://openapi.alipay.com/gateway.do';
         $fuwudata = array('app_id' => $app_id, 'method' => 'alipay.system.oauth.token', 'charset' => 'UTF-8', 'sign_type' => 'RSA', 'timestamp' => date('Y-m-d H:i:s', time()), 'version' => '1.0', 'grant_type' => 'authorization_code', 'code' => $auth_code);
         require './PigCms/Lib/ORG/Fuwu/config.php';
         $AlipaySign = new AlipaySign();
         ksort($fuwudata);
         $params = array();
         foreach ($fuwudata as $key => $value) {
             $params[] = $key . '=' . $value;
         }
         $fuwudata_build = implode('&', $params);
         $fuwudata['sign'] = $AlipaySign->rsa_sign($fuwudata_build, $config['merchant_private_key_file']);
         $re = new HttpRequest();
         $fuwu_result = $re->sendPostRequst($fuwuurl, $fuwudata);
         $return = json_decode(iconv('GBK', 'UTF-8', $fuwu_result), true);
         if ($return['alipay_system_oauth_token_response']['access_token'] != '') {
             $auth_token = $return['alipay_system_oauth_token_response']['access_token'];
             $userinfo_url = 'https://openapi.alipay.com/gateway.do';
             $userinfo_data = array('app_id' => $app_id, 'method' => 'alipay.user.userinfo.share', 'charset' => 'GBK', 'sign_type' => 'RSA', 'timestamp' => date('Y-m-d H:i:s', time()), 'version' => '1.0', 'auth_token' => $auth_token);
             ksort($userinfo_data);
             $params2 = array();
             foreach ($userinfo_data as $key2 => $value2) {
                 $params2[] = $key2 . '=' . $value2;
             }
             $userinfo_data_build = implode('&', $params2);
             $userinfo_data['sign'] = $AlipaySign->rsa_sign($userinfo_data_build, $config['merchant_private_key_file']);
             $userinfo_result = $re->sendPostRequst($userinfo_url, $userinfo_data);
             $userinfo_return = json_decode(iconv('GBK', 'UTF-8', $userinfo_result), true);
             if ($userinfo_return['alipay_user_userinfo_share_response']['user_id'] != '') {
                 $m_fuwuuser = M('fuwuuser');
                 $where_fuwuuser['wecha_id'] = 'z_' . md5($userinfo_return['alipay_user_userinfo_share_response']['user_id']);
                 $where_fuwuuser['token'] = $token;
                 $fuwuuser = $m_fuwuuser->where($where_fuwuuser)->find();
                 if ($fuwuuser == '') {
                     $add_fuwuuser = $userinfo_return['alipay_user_userinfo_share_response'];
                     $add_fuwuuser['wecha_id'] = 'z_' . md5($userinfo_return['alipay_user_userinfo_share_response']['user_id']);
                     $add_fuwuuser['token'] = $token;
                     $add_fuwuuser['addtime'] = time();
                     $id_fuwuuser = $m_fuwuuser->add($add_fuwuuser);
                 } else {
                     $save_fuwuuser = $userinfo_return['alipay_user_userinfo_share_response'];
                     $update_fuwuuser = $m_fuwuuser->where($where_fuwuuser)->save($save_fuwuuser);
                 }
                 $wecha_id = 'z_' . md5($userinfo_return['alipay_user_userinfo_share_response']['user_id']);
                 return $wecha_id;
             }
         }
     }
 }
开发者ID:hehekeke,项目名称:pigcms,代码行数:57,代码来源:FuwuOAuth.class.php

示例2: apiData

 public function apiData($method, $biz_content)
 {
     $url = 'https://openapi.alipay.com/gateway.do';
     $data = array('app_id' => $this->appid, 'method' => $method, 'charset' => 'UTF-8', 'sign_type' => 'RSA', 'timestamp' => date('Y-m-d H:i:s', time()), 'biz_content' => $biz_content, 'version' => '1.0');
     require './weimicms/Lib/ORG/Fuwu/config.php';
     $AlipaySign = new AlipaySign();
     $data['sign'] = $AlipaySign->rsa_sign($this->buildQuery($data), $config['merchant_private_key_file']);
     $re = new HttpRequest();
     $result = $re->sendPostRequst($url, $data);
     return json_decode(iconv('GBK', 'UTF-8', $result), true);
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:11,代码来源:ButtonAction.class.php

示例3: fuwu_code

 public function fuwu_code()
 {
     require './PigCms/Lib/ORG/Fuwu/HttpRequst.php';
     require './PigCms/Lib/ORG/Fuwu/aop/AopClient.php';
     require './PigCms/Lib/ORG/Fuwu/AlipaySign.php';
     $sceneId = (int) $_GET['id'];
     $biz_content = '{"codeInfo": {"scene": {"sceneId": "' . $sceneId . '"}},"codeType": "PERM","expireSecond": "","showLogo": "N"}';
     $app_id = M("Wxuser")->where(array('token' => $this->token))->getField('fuwuappid');
     $url = 'https://openapi.alipay.com/gateway.do';
     $data = array('app_id' => $app_id, 'method' => 'alipay.mobile.public.qrcode.create', 'charset' => 'UTF-8', 'sign_type' => 'RSA', 'timestamp' => date('Y-m-d H:i:s', time()), 'biz_content' => $biz_content, 'version' => '1.0');
     require './PigCms/Lib/ORG/Fuwu/config.php';
     $AlipaySign = new AlipaySign();
     $data['sign'] = $AlipaySign->rsa_sign($this->buildQuery($data), $config['merchant_private_key_file']);
     $re = new HttpRequest();
     $result = $re->sendPostRequst($url, $data);
     $return = json_decode(iconv('GBK', 'UTF-8', $result), true);
     if ($return['alipay_mobile_public_qrcode_create_response']['code'] == 200) {
         $GetDb = M('Recognition');
         $where_GetDb['id'] = $sceneId;
         $save_GetDb['fuwu_code_url'] = $return['alipay_mobile_public_qrcode_create_response']['code_img'];
         $update_GetDb = $GetDb->where($where_GetDb)->save($save_GetDb);
         if ($update_GetDb != false) {
             $this->success('获取成功');
         } else {
             $this->error('操作失败');
         }
     }
 }
开发者ID:node-rookie,项目名称:bdg,代码行数:28,代码来源:RecognitionAction.class.php

示例4: sendMsgRequest

	/**
	 * 异步发送消息给用户
	 *
	 * @param string $biz_content        	
	 * @param string $isMultiSend
	 *        	如果发给所有人,则此参数必须为true,且biz_content中的toUserId必须为空
	 * @return string
	 */
	public function sendMsgRequest($biz_content, $isMultiSend = FALSE) {
		require FUWU_PATH.'config.php';
		$paramsArray = array (
				'method' => "alipay.mobile.public.message.custom.send",
				'biz_content' => $biz_content,
				'charset' => $config ['charset'],
				'sign_type' => 'RSA',
				'app_id' => FUWU_APPID,
				'timestamp' => date ( 'Y-m-d H:i:s', time () ) 
		);
		if ($isMultiSend) {
			$paramsArray ['method'] = "alipay.mobile.public.message.total.send";
		}
		require_once FUWU_PATH.'AlipaySign.php';
		$as = new AlipaySign ();
		$sign = $as->sign_request ( $paramsArray, $config ['merchant_private_key_file'] );
		$paramsArray ['sign'] = $sign;
		// print_r ( $paramsArray );
		// 日志记录下受到的请求
		file_put_contents ( "log.txt", var_export ( $paramsArray, true ) . "\r\n", FILE_APPEND );
		return HttpRequest::sendPostRequst ( $config ['gatewayUrl'], $paramsArray );
	}
开发者ID:kevicki,项目名称:pig,代码行数:30,代码来源:PushMsg.php

示例5: menuQuery

 public function menuQuery()
 {
     global $_GP;
     require_once WEB_ROOT . '/includes/lib/alipaySDK/config.php';
     require_once WEB_ROOT . '/includes/lib/alipaySDK/HttpRequst.php';
     require_once WEB_ROOT . '/includes/lib/alipaySDK/AopSdk.php';
     $menus_get = new AlipayMobilePublicMenuGetRequest();
     $parDatas = $this->bulidMenuPostData($menus_get->getApiMethodName());
     $content = HttpRequest::sendPostRequst($_GP['alipay_config']['gatewayUrl'], $parDatas);
     $datas = @json_decode(mb_convert_encoding($content, "UTF-8", "GBK"), true);
     $menu_content = $datas['alipay_mobile_public_menu_get_response']["menu_content"];
     $menusArr = @json_decode($menu_content, true);
     if (is_array($menusArr)) {
         $menus = array();
         foreach ($menusArr['button'] as $val) {
             $m = array();
             $m['type'] = $val['actionType'] == 'link' ? 'url' : 'click';
             $m['title'] = $val['name'];
             if ($m['type'] == 'click') {
                 $m['forward'] = $val['actionParam'];
             } else {
                 $m['url'] = $val['actionParam'];
             }
             $m['subMenus'] = array();
             if (!empty($val['subButton'])) {
                 foreach ($val['subButton'] as $v) {
                     $s = array();
                     $s['type'] = $v['actionType'] == 'link' ? 'url' : 'click';
                     $s['title'] = $v['name'];
                     if ($s['type'] == 'click') {
                         $s['forward'] = $v['actionParam'];
                     } else {
                         $s['url'] = $v['actionParam'];
                     }
                     $m['subMenus'][] = $s;
                 }
             }
             $menus[] = $m;
         }
         return $menus;
     }
 }
开发者ID:jaydom,项目名称:weishang,代码行数:42,代码来源:web.php

示例6: fuwu_code

 public function fuwu_code()
 {
     if (intval($this->wxuser["winxintype"]) != 3 && $this->wxuser["fuwuappid"] == "") {
         $this->error($isgostr);
         exit;
     }
     require "./weimicms/Lib/ORG/Fuwu/HttpRequst.php";
     require "./weimicms/Lib/ORG/Fuwu/aop/AopClient.php";
     require "./weimicms/Lib/ORG/Fuwu/AlipaySign.php";
     $sceneId = (int) $_GET["id"];
     $biz_content = "{\"codeInfo\": {\"scene\": {\"sceneId\": \"" . $sceneId . "\"}},\"codeType\": \"PERM\",\"expireSecond\": \"\",\"showLogo\": \"N\"}";
     $app_id = M("Wxuser")->where(array("token" => $this->token))->getField("fuwuappid");
     $url = "https://openapi.alipay.com/gateway.do";
     $data = array("app_id" => $app_id, "method" => "alipay.mobile.public.qrcode.create", "charset" => "UTF-8", "sign_type" => "RSA", "timestamp" => date("Y-m-d H:i:s", time()), "biz_content" => $biz_content, "version" => "1.0");
     require "./weimicms/Lib/ORG/Fuwu/config.php";
     $AlipaySign = new AlipaySign();
     $data["sign"] = $AlipaySign->rsa_sign($this->buildQuery($data), $config["merchant_private_key_file"]);
     $re = new HttpRequest();
     $result = $re->sendPostRequst($url, $data);
     $return = json_decode(iconv("GBK", "UTF-8", $result), true);
     if ($return["alipay_mobile_public_qrcode_create_response"]["code"] == 200) {
         $GetDb = M("Recognition");
         $where_GetDb["id"] = $sceneId;
         $save_GetDb["fuwu_code_url"] = $return["alipay_mobile_public_qrcode_create_response"]["code_img"];
         $update_GetDb = $GetDb->where($where_GetDb)->save($save_GetDb);
         if ($update_GetDb != false) {
             $this->success("获取成功");
         } else {
             $this->error("操作失败");
         }
     } else {
         $this->error("appid不正确");
     }
 }
开发者ID:liuguogen,项目名称:weixin,代码行数:34,代码来源:RecognitionAction.class.php


注:本文中的HttpRequest::sendPostRequst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。