當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Http::factory方法代碼示例

本文整理匯總了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, '', '&');
 }
開發者ID:676496871,項目名稱:Demo,代碼行數:33,代碼來源:merchant.php

示例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;
開發者ID:676496871,項目名稱:Demo,代碼行數:15,代碼來源:search.php

示例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;
    }
開發者ID:flyysr,項目名稱:emlog,代碼行數:31,代碼來源:getemlog.php


注:本文中的Http::factory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。