国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Rumah php教程 PHP源碼 基于php的加油卡充值接口調(diào)用代碼實(shí)例

基于php的加油卡充值接口調(diào)用代碼實(shí)例

Nov 08, 2016 pm 01:36 PM

<?php
// +----------------------------------------------------------------------
// | JuhePHP [ NO ZUO NO DIE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010-2015 http://juhe.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: Juhedata <info@juhe.cn>
// +----------------------------------------------------------------------
  
//----------------------------------
// 加油卡充值調(diào)用示例代碼 - 聚合數(shù)據(jù)
// 在線接口文檔:http://www.juhe.cn/docs/87
//----------------------------------
  
header(&#39;Content-type:text/html;charset=utf-8&#39;);
  
  
//配置您申請的appkey
$appkey = "*********************";
  
  
  
  
//************1.訂單狀態(tài)查詢************
$url = "http://op.juhe.cn/ofpay/sinopec/ordersta";
$params = array(
      "orderid" => "",//商家訂單號(hào),8-32位字母數(shù)字組合
      "key" => $appkey,//應(yīng)用APPKEY(應(yīng)用詳細(xì)頁查詢)
);
$paramstring = http_build_query($params);
$content = juhecurl($url,$paramstring);
$result = json_decode($content,true);
if($result){
    if($result[&#39;error_code&#39;]==&#39;0&#39;){
        print_r($result);
    }else{
        echo $result[&#39;error_code&#39;].":".$result[&#39;reason&#39;];
    }
}else{
    echo "請求失敗";
}
//**************************************************
  
  
  
  
//************2.賬戶余額查詢************
$url = "http://op.juhe.cn/ofpay/sinopec/yue";
$params = array(
      "timestamp" => "",//當(dāng)前時(shí)間戳,如:1432788379
      "key" => $appkey,//應(yīng)用APPKEY(應(yīng)用詳細(xì)頁查詢)
      "sign" => "",//校驗(yàn)值,md5(OpenID+key+timestamp),OpenID在個(gè)人中心查詢
);
$paramstring = http_build_query($params);
$content = juhecurl($url,$paramstring);
$result = json_decode($content,true);
if($result){
    if($result[&#39;error_code&#39;]==&#39;0&#39;){
        print_r($result);
    }else{
        echo $result[&#39;error_code&#39;].":".$result[&#39;reason&#39;];
    }
}else{
    echo "請求失敗";
}
//**************************************************
  
  
  
  
//************3.加油卡充值************
$url = "http://op.juhe.cn/ofpay/sinopec/onlineorder";
$params = array(
      "proid" => "",//產(chǎn)品id:10000(中石化50元加油卡)、10001(中石化100元加油卡)、10003(中石化500元加油卡)、10004(中石化1000元加油卡)、10007(中石化任意金額充值)、10008(中石油任意金額充值)
      "cardnum" => "",//充值數(shù)量 任意充 (整數(shù)(元)),其余面值固定值為1
      "orderid" => "",//商家訂單號(hào),8-32位字母數(shù)字組合
      "game_userid" => "",//加油卡卡號(hào),中石化:以100011開頭的卡號(hào)、中石油:以9開頭的卡號(hào)
      "gasCardTel" => "",//持卡人手機(jī)號(hào)碼
      "gasCardName" => "",//持卡人姓名
      "chargeType" => "",//加油卡類型 (1:中石化、2:中石油;默認(rèn)為1)
      "key" => $appkey,//應(yīng)用APPKEY(應(yīng)用詳細(xì)頁查詢)
      "sign" => "",//校驗(yàn)值,md5(OpenID+key+proid+cardnum+game_userid+orderid),OpenID在個(gè)人中心查詢
);
$paramstring = http_build_query($params);
$content = juhecurl($url,$paramstring);
$result = json_decode($content,true);
if($result){
    if($result[&#39;error_code&#39;]==&#39;0&#39;){
        print_r($result);
    }else{
        echo $result[&#39;error_code&#39;].":".$result[&#39;reason&#39;];
    }
}else{
    echo "請求失敗";
}
//**************************************************
  
  
  
  
  
/**
 * 請求接口返回內(nèi)容
 * @param  string $url [請求的URL地址]
 * @param  string $params [請求的參數(shù)]
 * @param  int $ipost [是否采用POST形式]
 * @return  string
 */
function juhecurl($url,$params=false,$ispost=0){
    $httpInfo = array();
    $ch = curl_init();
  
    curl_setopt( $ch, CURLOPT_HTTP_VERSION , CURL_HTTP_VERSION_1_1 );
    curl_setopt( $ch, CURLOPT_USERAGENT , &#39;JuheData&#39; );
    curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT , 60 );
    curl_setopt( $ch, CURLOPT_TIMEOUT , 60);
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER , true );
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    if( $ispost )
    {
        curl_setopt( $ch , CURLOPT_POST , true );
        curl_setopt( $ch , CURLOPT_POSTFIELDS , $params );
        curl_setopt( $ch , CURLOPT_URL , $url );
    }
    else
    {
        if($params){
            curl_setopt( $ch , CURLOPT_URL , $url.&#39;?&#39;.$params );
        }else{
            curl_setopt( $ch , CURLOPT_URL , $url);
        }
    }
    $response = curl_exec( $ch );
    if ($response === FALSE) {
        //echo "cURL Error: " . curl_error($ch);
        return false;
    }
    $httpCode = curl_getinfo( $ch , CURLINFO_HTTP_CODE );
    $httpInfo = array_merge( $httpInfo , curl_getinfo( $ch ) );
    curl_close( $ch );
    return $response;
}

Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn

Alat AI Hot

Undress AI Tool

Undress AI Tool

Gambar buka pakaian secara percuma

Undresser.AI Undress

Undresser.AI Undress

Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover

AI Clothes Remover

Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Clothoff.io

Clothoff.io

Penyingkiran pakaian AI

Video Face Swap

Video Face Swap

Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Alat panas

Notepad++7.3.1

Notepad++7.3.1

Editor kod yang mudah digunakan dan percuma

SublimeText3 versi Cina

SublimeText3 versi Cina

Versi Cina, sangat mudah digunakan

Hantar Studio 13.0.1

Hantar Studio 13.0.1

Persekitaran pembangunan bersepadu PHP yang berkuasa

Dreamweaver CS6

Dreamweaver CS6

Alat pembangunan web visual

SublimeText3 versi Mac

SublimeText3 versi Mac

Perisian penyuntingan kod peringkat Tuhan (SublimeText3)

Topik panas

Tutorial PHP
1502
276