本文整理汇总了PHP中Http::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::factory方法的具体用法?PHP Http::factory怎么用?PHP Http::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::factory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
public static function notify($arr, $config)
{
$resParam = array("version" => $config['version'], "charset" => $config['charset'], "signMethod" => $config['signMethod'], "successLable" => '');
$merchantKey = $config['merchantKey'];
$sign_method = strtolower(str_replace('-', '', $config['signMethod']));
if (empty($arr['signature'])) {
$resParam['successLable'] = 'signature参数不能为空!';
} else {
if (self::validateSign($arr, $merchantKey)) {
$param = array();
$param['signMethod'] = 'SHA-256';
$param['transType'] = '004';
$param['merchantId'] = $arr['merchantId'];
$param['notifyId'] = $arr['notifyId'];
ksort($param);
$param['signature'] = hash($sign_method, self::get_http_query($param) . $merchantKey);
//var_dump($param);die;
$http = Http::factory(Http::TYPE_STREAM);
$resPost = $http->post($config['postUrl'], $param);
//var_dump($resPost);die;
if ($resPost == 'TRUE') {
$resParam['successLable'] = "S";
} else {
$resParam['successLable'] = "N";
}
} else {
$resParam['successLable'] = 'N';
}
}
ksort($resParam);
$resParam['signature'] = hash($sign_method, self::get_http_query($resParam) . $merchantKey);
return http_build_query($resParam, '', '&');
}
示例2: error_reporting
<?php
/**
* 商户查询功能demo
* $Author: zhaoshuangxi
*/
error_reporting(0);
require "config.php";
require "http.php";
require "merchant.class.php";
$http = Http::factory(Http::TYPE_STREAM);
$arr = array("version" => $config['version'], "charset" => $config['charset'], "signMethod" => $config['signMethod'], "transType" => "005", "merId" => $config['merchantId'], "merchantKey" => $config['merchantKey'], "mercOrderNo" => "1234500026", "signature" => "");
$arr['signature'] = Merchant::sign($arr);
$res = $http->post($config['postUrl'], $arr);
print $res;
示例3: define
define('DOC_ROOT', dirname(__FILE__));
$action = isset($_GET['action']) ? $_GET['action'] : '';
if ($action == 'go') {
$emlog_zip = $_POST['emlog_zip'];
if (empty($emlog_zip)) {
die('压缩包地址为空');
}
$http = null;
try {
$http = Http::factory($emlog_zip, Http::TYPE_CURL);
} catch (Exception $e) {
try {
$http = Http::factory($emlog_zip, Http::TYPE_SOCK);
} catch (Exception $e) {
try {
$http = Http::factory($emlog_zip, Http::TYPE_STREAM);
} catch (Exception $e) {
die('您空间的PHP不支持远程下载.');
}
}
}
if (!$http) {
die('您空间的PHP不支持远程下载.');
}
try {
$data = $http->send();
} catch (Exception $e) {
echo '下载EMLOG压缩包时出现错误: <br>';
echo $e->getMessage();
die;
}