本文整理汇总了PHP中HttpClient::quickPost方法的典型用法代码示例。如果您正苦于以下问题:PHP HttpClient::quickPost方法的具体用法?PHP HttpClient::quickPost怎么用?PHP HttpClient::quickPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpClient
的用法示例。
在下文中一共展示了HttpClient::quickPost方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: http_post
function http_post($opt, $data)
{
$url = $this->base . '&opt=' . $opt;
if ($this->client_type == 'curl') {
return $this->http->post($url, $data);
} else {
return HttpClient::quickPost($url, $data);
}
}
示例2: papaki_DeleteNameserver
function papaki_DeleteNameserver($params)
{
$username = '';
$password = '';
$apikey = encodetolatin($params["APIkey"]);
$posturl = encodetolatin($params["PostUrl"]);
$testmode = encodetolatin($params["TestMode"]);
$tld = encodetolatin($params["tld"]);
$sld = encodetolatin($params["sld"]);
$nameserver = encodetolatin($params["nameserver"]);
# Put your code to delete the nameserver here
########################
$json = new Services_JSON();
$jsonarray = array("request" => array("do" => 'deletens', "username" => $username, "password" => $password, "apiKey" => $apikey, "domainname" => $sld . "." . $tld, "registration_type" => '2', "test" => 'False', "ns" => $nameserver));
$Xpost = $json->encode($jsonarray);
$Xpost = latintogreek($Xpost);
$headers = array('Content-type: application/x-www-form-urlencoded');
$pageContents = HttpClient::quickPost($params["PostUrl"], array('message' => $Xpost));
$responsearray = $json->decode($pageContents);
$codeNode = $responsearray->response->code;
$message = $responsearray->response->message;
// if ($codeNode!="1000" ){
// $values["error"]='Error: ' . $codeNode . ' - ' . $message;
//}
$values["error"] = 'Error: Not Supported';
#####################################
# If error, return the error message in the value below
// $values["error"] = $error;
return $values;
}
示例3: eposSale
function eposSale(array $bizArray, $actionURL, $merchantKey, $logName)
{
// 调用签名函数生成签名串
$ReqHmacString = getReqHmacString($bizArray, $logName, $merchantKey);
// 组成请求串
$actionHttpString = HttpClient::buildQueryString($bizArray) . "&pr_NeedResponse=1" . "&hmac=" . $ReqHmacString;
// echo $actionURL."?".$actionHttpString;exit;
// 记录发起支付请求的参数
logurl("发起请求", $actionURL . "?" . $actionHttpString, $logName);
// 发起支付请求
$pageContents = HttpClient::quickPost($actionURL, $actionHttpString);
if ($GLOBALS['uid'] == '20310462') {
echo $pageContents . "<br>";
}
// 记录收到的提交结果
logurl("请求回写", $pageContents, $logName);
$result = explode("\n", $pageContents);
for ($index = 0; $index < count($result); $index++) {
$result[$index] = trim($result[$index]);
if (strlen($result[$index]) == 0) {
continue;
}
$aryReturn = explode("=", $result[$index]);
$sKey = $aryReturn[0];
$sValue = $aryReturn[1];
if ($sKey == "r0_Cmd") {
$r0_Cmd = $sValue;
} elseif ($sKey == "r1_Code") {
$r1_Code = $sValue;
} elseif ($sKey == "r2_TrxId") {
$r2_TrxId = $sValue;
} elseif ($sKey == "r6_Order") {
$r6_Order = $sValue;
} elseif ($sKey == "errorMsg") {
$errorMsg = $sValue;
} elseif ($sKey == "hmac") {
$hmac = $sValue;
}
/* else{
return $result[$index];
} */
}
$hmac = iconv("UTF-8", "GB2312", $hmac);
// 进行校验码检查 取得加密前的字符串
$sbOld = "";
// 加入业务类型
$sbOld = $sbOld . $r0_Cmd;
// 加入支付结果
$sbOld = $sbOld . $r1_Code;
// 加入易宝支付交易流水号
$sbOld = $sbOld . $r2_TrxId;
// 加入商户订单号
$sbOld = $sbOld . $r6_Order;
$sNewString = HmacMd5($sbOld, $merchantKey, $logName);
logurl("订单号:" . $r6_Order, "本地生成HMAC:" . $sNewString . "返回HMAC:" . $hmac, $logName);
$uid = substruid($r6_Order, 14);
$money = $bizArray['p3_Amt'];
global $_MooClass, $dbTablePre;
$sql_getpayid = "SELECT max(id) id FROM {$dbTablePre}payment_new WHERE order_id='{$r6_Order}'";
$getpayid = $_MooClass['MooMySQL']->getOne($sql_getpayid, true);
$id = $getpayid['id'];
$sql_p = "SELECT pay_service FROM {$dbTablePre}payment_new WHERE id='{$id}'";
$payservice = $_MooClass['MooMySQL']->getOne($sql_p, true);
// if($money=='1899'){
// $attach='0';
// }elseif($money=='1399'){
// $attach='1';
// }elseif($money=='1399.00'){
// $attach='2';
// }else{
// $attach='1';
// }
//
if ($payservice['pay_service'] == '0') {
$attach = '0';
} elseif ($payservice['pay_service'] == '1' || $payservice['pay_service'] == '3') {
$attach = '1';
} elseif ($payservice['pay_service'] == '2') {
$attach = '2';
} else {
$attach = '1';
}
if ($GLOBALS['uid'] == '20310462') {
echo $sNewString;
exit;
}
// 校验码正确
if ($sNewString == $hmac) {
if ($r1_Code == "1") {
logurl("请求成功", "本地生成HMAC:" . $sNewString . "返回HMAC:" . $hmac, $logName);
//返回信息 数组表示
$paytime = date("Y.m.d H:i:s");
$payurl = array('pay' => '1', 'out_trade_no' => $r6_Order, 'paytime' => $paytime, 'bank_type' => '易宝支付', 'trade_state' => '0', 'get_img' => '05.gif', 'img' => $attach, 'total_fee' => $bizArray['p3_Amt'], 'uid' => $uid);
//会员ID
$payurl = implode(',', $payurl);
$payurl = $payurl . ',yeepay';
header("Location:./../../index.php?n=payment&h=payreturnurl&payurl=" . $payurl);
return;
} elseif ($r1_Code == "66") {
$errorinfo = iconv("GB2312", "UTF-8", "订单金额过小!");
//.........这里部分代码省略.........
示例4: getcode
public function getcode()
{
$code = $this->rand_number(100000, 999999);
//普通提交方式
include_once 'HttpClient.class.php';
//目标主机的地址,我这里填上测试的地址
$Client = new HttpClient("mssms.cn:8000");
$url = "http://222.185.228.25:8000/msm/sdk/http/sendsmsutf8.jsp";
//请求的页面地址
//POST的参数
$mobile = $this->_post('mobile');
$params = array('username' => "JSMB260705", 'scode' => "095169", 'mobile' => $mobile, 'content' => "@1@={$code}", 'tempid' => "MB-2013102300");
$pageContents = HttpClient::quickPost($url, $params);
echo "提交返回=" . $pageContents;
exit;
$token = '540e6acfz71';
$wecha_id = $this->_get('wecha_id');
$tel = '15678456321';
$cardnum = 'LZ948820080012';
$where = array('token' => $token, 'tel' => $tel, 'cardnum' => $cardnum);
//根据电话号码验证会员是否被导入
$userinfo = M("physical_member")->where($where)->find();
if (!$userinfo) {
echo '{"success":0,"msg":"没有找到您的会员卡信息,请联系商家导入。"}';
exit;
} elseif ($userinfo['binded']) {
echo '{"success":0,"msg":"此手机号已被绑定."}';
exit;
} elseif ($userinfo['cardnum'] != $cardnum) {
echo '{"success":0,"msg":"您输入的手机号与卡号不匹配,请重新输入。"}';
exit;
}
$Cache = Cache::getInstance('File', array('expire' => '310'));
$scode = $Cache->get($token . $tel);
if (!empty($scode)) {
// 避免多次发送
echo '{"success":0,"msg":"验证码已发送,请稍侯。"}';
exit;
}
$code = $this->rand_number(100000, 999999);
$Cache->set($token . $tel, $code);
Log::record("Send code : " . $code . " at " . date("Y-m-d H:i:s") . "\r\n", Log::DEBUG);
include LIB_PATH . 'Action/SmsSender.class.php';
$smsSender = new SmsSender();
$binding_tmpl = C('card_binding');
$smsContent = '';
if (isset($binding_tmpl)) {
$smsContent = str_replace("#merchant#", '领众科技', $binding_tmpl);
$smsContent = str_replace("#code#", $code, $smsContent);
}
if ($smsContent != '') {
$re = $smsSender->notify($this->_get('token'), "huiyuan", $smsContent, $tel);
if ($re == 0) {
$Cache->set($token . $tel, $code);
echo '{"success":1,"msg":"验证码已发送,请输入收到的短信验证码!"}';
} else {
echo '{"success":0,"msg":"验证码发送失败,请稍侯再试。"}';
}
} else {
echo '{"success":0,"msg":"验证码发送失败,请稍侯再试。"}';
}
}
示例5: exec_request_for
function exec_request_for($type = _TYPE_DS, $use_get_extenssions_func = true)
{
$this->type = $type;
//$exts=array('.'.$this->tld);
$json = new Services_JSON();
$jsonarray = array("request" => array("type" => $type, "apiKey" => encodetolatin($this->apikey), "username" => '', "password" => '', "domain" => encodetolatin($this->domainName), "lang" => 'el', "test" => 'False', "extensions" => array("ext" => array('.' . $this->tld))));
if ($this->type == _TYPE_WHOIS) {
$jsonarray = array("request" => array("type" => $type, "apiKey" => encodetolatin($this->apikey), "username" => '', "password" => '', "domain" => encodetolatin($this->domainName), "lang" => 'el', "test" => 'False'));
}
//print_r($jsonarray);
$Xpost = $json->encode($jsonarray);
$Xpost = latintogreek($Xpost);
$headers = array('Content-type: application/x-www-form-urlencoded');
//print '<pre>'.$Xpost.'<br /><br />'.'</pre>';
$pageContents = HttpClient::quickPost($this->requestURL, array('message' => $Xpost));
//print '<pre>'.$pageContents.'<br /><br />'.'</pre>';
$this->responsearray = $json->decode($pageContents);
//print_r($this->responsearray );
$this->parseResponse();
$this->domainName = $this->IDN->decode($this->domainName);
}
示例6: getOrderInfo
public function getOrderInfo($trans_no, $type = 'normal')
{
require_once 'HttpClient.class.php';
//业务类型
$post_data['p0_Cmd'] = 'QueryOrdDetail';
//商户编号
$post_data['p1_MerId'] = $this->MemberID;
//商户订单号
$post_data['p2_Order'] = $trans_no;
//获取签名
$post_data['hmac'] = $this->getHmacString($post_data, $this->merchantKey);
$pageContents = HttpClient::quickPost($this->reqURL_Info, $post_data);
$result = explode("\n", $pageContents);
$result_arr = array();
foreach ($result as $key => $value) {
if ($value != '') {
$tmp = explode('=', $value);
if (!empty($tmp)) {
$result_arr[$tmp[0]] = $tmp[1];
}
}
}
if ($type == 'normal') {
//整理数据返回
$pay_status = 'N';
if ($result_arr['r1_Code'] == 50) {
$pay_status = 'N';
}
switch ($result_arr['rb_PayStatus']) {
case 'INIT':
$pay_status = 'P';
break;
case 'CANCELED':
$pay_status = 'F';
break;
case 'SUCCESS':
$pay_status = 'Y';
break;
default:
$pay_status = 'N';
break;
}
$return_array = array('status' => '1', 'succMoney' => $result_arr['r3_Amt'], 'TransID' => $result_arr['r6_Order'] != '' ? $result_arr['r6_Order'] : $trans_no, 'SuccTime' => $result_arr['ry_FinshTime'], 'CheckResult' => $pay_status);
return $return_array;
} else {
if ($type == 'all') {
return $result_arr;
}
}
}
示例7: HttpClient
<?php
include_once 'HttpClient.class.php';
$Client = new HttpClient("mssms.cn:8000");
$auth_code = rand(1000, 9999);
$params = array('username' => "JSMB260519", 'scode' => "321791", 'mobile' => "15800651149", 'content' => "@1@={$auth_code}", 'tempid' => "MB-2013102300");
$url = "http://www.mssms.cn:8000/msm/sdk/http/sendsms.jsp";
$pageContents = HttpClient::quickPost($url, $params);
echo "=" . $pageContents;
示例8: HmacMd5
$sbOld = $sbOld . $p1_MerId;
# 加入易宝支付交易流水号
$sbOld = $sbOld . $pb_TrxId;
# 加入退款金额
$sbOld = $sbOld . $p3_Amt;
# 加入交易币种
$sbOld = $sbOld . $p4_Cur;
# 加入退款说明
$sbOld = $sbOld . $p5_Desc;
$hmac = null;
$hmac = HmacMd5($sbOld, $merchantKey);
logstr($pb_TrxId, $sbOld, HmacMd5($sbOld, $merchantKey));
# 进行签名处理,一定按照文档中标明的签名顺序进行
# 加入订单查询请求,固定值"QueryOrdDetail"
$params = array('p0_Cmd' => $p0_Cmd, 'p1_MerId' => $p1_MerId, 'pb_TrxId' => $pb_TrxId, 'p3_Amt' => $p3_Amt, 'p4_Cur' => $p4_Cur, 'p5_Desc' => $p5_Desc, 'hmac' => $hmac);
$pageContents = HttpClient::quickPost($reqURL_RefOrd, $params);
$result = explode("\n", $pageContents);
## 声明查询结果
$r0_Cmd = "";
# 业务类型
$r1_Code = "";
# 退款申请结果
$r2_TrxId = "";
# 易宝支付交易流水号
$r3_Amt = "";
# 退款金额
$r4_Cur = "";
# 交易币种
$hmac = "";
# 签名数据
#echo "result.count:".count($result);
示例9: HmacMd5
$QueryOrdURL_onLine = "http://tech.yeepay.com:8080/robot/debug.action";
# 进行签名处理,一定按照文档中标明的签名顺序进行
$sbOld = "";
# 加入订单查询请求,固定值"QueryOrdDetail"
$sbOld = $sbOld . $p0_Cmd;
# 加入商户编号
$sbOld = $sbOld . $p1_MerId;
# 加入商户订单号
$sbOld = $sbOld . $p2_Order;
$hmac = null;
$hmac = HmacMd5($sbOld, $merchantKey);
logstr($p2_Order, $sbOld, HmacMd5($sbOld, $merchantKey));
# 进行签名处理,一定按照文档中标明的签名顺序进行
# 加入订单查询请求,固定值"QueryOrdDetail"
$params = array('p0_Cmd' => $p0_Cmd, 'p1_MerId' => $p1_MerId, 'p2_Order' => $p2_Order, 'hmac' => $hmac);
$pageContents = HttpClient::quickPost($QueryOrdURL_onLine, $params);
$result = explode("\n", $pageContents);
## 声明查询结果
$r0_Cmd = "";
# 取得业务类型
$r1_Code = "";
# 查询结果状态码
$r2_TrxId = "";
# 易宝支付交易流水号
$r3_Amt = "";
# 支付金额
$r4_Cur = "";
# 交易币种
$r5_Pid = "";
# 商品名称
$r6_Order = "";
示例10: createOrder
/**
* Wechat::createorder()
* 生成预支付订单
* @param array $access_token
* @param array $parameter
* @return array
*/
public function createOrder($access_token, $parameter)
{
$url = 'https://api.weixin.qq.com/pay/genprepay?access_token=' . $access_token;
$params = array('appid' => $this->wechat_config['app_id'], 'traceid' => '', 'noncestr' => uniqid(), 'package' => $this->buildPackage($parameter), 'timestamp' => time());
//用于之后的手机唤起 sign
$this->wechat_noncestr = $params['noncestr'];
$this->wechat_time = $params['timestamp'];
$params['app_signature'] = $this->buildSign($params);
$params['sign_method'] = 'sha1';
$result = HttpClient::quickPost($url, json_encode($params));
return json_decode($result, true);
}
示例11: sendsmsbyfeikuo
function sendsmsbyfeikuo($mobile, $content)
{
Vendor('HttpClient.HttpClient');
//include_once('HttpClient.php');
//目标主机的地址,我这里填上测试的地址
$Client = new \vendor\HttpClient\HttpClient("mssms.cn:8000");
$url = "http://mssms.cn:8000/msm/sdk/http/sendsms.jsp";
//请求的页面地址
//POST的参数
$params = array('username' => "NTY105029", 'scode' => "1111111", 'mobile' => $mobile, 'content' => $content, 'tempid' => "MB-2013102300");
$pageContents = \HttpClient::quickPost($url, $params);
return $pageContents;
}
示例12: var_dump
<?php
include 'HttpClient.class.php';
//抓取页面的内容
$contents = HttpClient::quickGet('http://www.baidu.com/');
var_dump($contents);
//post请求某一个接口,返回的信息赋值给$res
$res = HttpClient::quickPost('http://example.com/sms.php', array('name' => 'kevin.liu', 'phone' => '18201042042'));
//可能有一些请求访问会出问题,则需要加一个userAgent
$client = new HttpClient('example.com');
$client->setDebug(true);
$client->setUserAgent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021207');
if (!$client->get('/')) {
die('An error occurred: ' . $client->getError());
}
$contents = $client->getContent();
//还有一些情况是:在采集数据的时候必须先登陆,则可以先模拟登陆
$client = new HttpClient('example.com');
$client->post('/login.php', array('username' => 'kevin', 'password' => '123456'));
if (!$client->get('/private.php')) {
//采集数据的目标地址
die('An error occurred: ' . $client->getError());
}
$pageContents = $client->getContent();
示例13: to_NodeJS_notice
/**
* 到Node.JS消息通知接口
*
* @param type $url
* @param type $msgType
* @param type $targetId
* @param type $body
* @return type
*/
function to_NodeJS_notice($data)
{
$return_arr = HttpClient::quickPost(_NODE_SERVER_URL, $data);
return $return_arr[1];
}
示例14: BindPhone
public function BindPhone($mobile)
{
$url = $this->bindphoneuri;
$openid = $this->GetOpenID();
$params = array('op' => $openid, 'mobile' => $mobile);
$str = \HttpClient::quickPost($url, $params);
$json_obj = json_decode(trim($str, chr(239) . chr(187) . chr(191)));
$code = $json_obj->code;
if ($code == "0") {
return true;
} else {
$error = $json_obj->error;
return $error;
}
}