• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP jsonRPCClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test

 /**
  * Simple procedure to test most RPC functions
  *
  */
 public function test()
 {
     $sFileToImport = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'demosurveys' . DIRECTORY_SEPARATOR . 'limesurvey2_sample_survey_english.lss';
     //        $sFileToImport=dirname(Yii::app()->basePath).DIRECTORY_SEPARATOR.'docs'.DIRECTORY_SEPARATOR.'demosurveys'.DIRECTORY_SEPARATOR.'survey_archive_example_feedback_survey.zip';
     Yii::app()->loadLibrary('jsonRPCClient');
     $myJSONRPCClient = new jsonRPCClient(Yii::app()->getBaseUrl(true) . '/' . dirname(Yii::app()->request->getPathInfo()));
     $sSessionKey = $myJSONRPCClient->get_session_key('admin', 'password');
     if (is_array($sSessionKey)) {
         echo $sSessionKey['status'];
         die;
     } else {
         echo 'Retrieved session key' . '<br>';
     }
     $sLSSData = base64_encode(file_get_contents($sFileToImport));
     $iSurveyID = $myJSONRPCClient->import_survey($sSessionKey, $sLSSData, 'zip', 'Test import by JSON_RPC', 1000);
     echo 'Created new survey SID:' . $iSurveyID . '<br>';
     /*
             Very simple example to export responses as Excel file
             $aResult=$myJSONRPCClient->export_reponses($sSessionKey,$iSurveyID,'xls');
             file_put_contents('d:\test.xls',base64_decode(chunk_split($aResult)));
     */
     $aResult = $myJSONRPCClient->activate_survey($sSessionKey, $iSurveyID);
     if ($aResult['status'] == 'OK') {
         echo 'Survey ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $myJSONRPCClient->activate_participant_tokens($sSessionKey, $iSurveyID, array(1, 2));
     if ($aResult['status'] == 'OK') {
         echo 'Tokens for Survey ID ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $myJSONRPCClient->set_survey_properties($sSessionKey, $iSurveyID, array('faxto' => '0800-LIMESURVEY'));
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey settings for survey ' . $iSurveyID . '<br>';
     }
     $aResult = $myJSONRPCClient->add_survey_language($sSessionKey, $iSurveyID, 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Added Arabian as additional language' . '<br>';
     }
     $aResult = $myJSONRPCClient->set_survey_language_properties($sSessionKey, $iSurveyID, array('surveyls_welcometext' => 'An Arabian welcome text!'), 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey locale setting welcometext for Arabian in survey ID ' . $iSurveyID . '<br>';
     }
     $aResult = $myJSONRPCClient->delete_survey_language($sSessionKey, $iSurveyID, 'ar');
     if ($aResult['status'] == 'OK') {
         echo 'Removed Arabian as additional language' . '<br>';
     }
     die;
     $aResult = $myJSONRPCClient->delete_survey($sSessionKey, $iSurveyID);
     echo 'Deleted survey SID:' . $iSurveyID . '-' . $aResult['status'] . '<br>';
     // Release the session key - close the session
     $Result = $myJSONRPCClient->release_session_key($sSessionKey);
     echo 'Closed the session' . '<br>';
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:56,代码来源:remotecontrol.php


示例2: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = $this->config->get('config_currency');
     $eMark_DEM_decimal = $this->config->get('eMark_DEM_decimal');
     $eMark_total = $order['eMark_total'];
     $eMark_address = $order['eMark_address'];
     require_once 'jsonRPCClient.php';
     $eMark = new jsonRPCClient('http://' . $this->config->get('eMark_rpc_username') . ':' . $this->config->get('eMark_rpc_password') . '@' . $this->config->get('eMark_rpc_address') . ':' . $this->config->get('eMark_rpc_port') . '/');
     try {
         $eMark_info = $eMark->getinfo();
     } catch (Exception $e) {
         $this->data['error'] = true;
     }
     try {
         $received_amount = $eMark->getreceivedbyaddress($eMark_address, 0);
         if (round((double) $received_amount, $eMark_DEM_decimal) >= round((double) $eMark_total, $eMark_DEM_decimal)) {
             $order = $this->model_checkout_order->getOrder($order_id);
             $this->model_checkout_order->confirm($order_id, $this->config->get('eMark_order_status_id'));
             echo "1";
         } else {
             echo "0";
         }
     } catch (Exception $e) {
         $this->data['error'] = true;
         echo "0";
     }
 }
开发者ID:Rumhocker,项目名称:OpenCart_eMark,代码行数:30,代码来源:eMark.php


示例3: bitcoin_link

function bitcoin_link($params)
{
    # Gateway Specific Variables
    $u = $params['username'];
    $p = $params['password'];
    $h = $params['host'] . ':' . $params['port'];
    $rpc = 'http://' . $u . ':' . $p . '@' . $h;
    # Invoice Variables
    $invoiceid = $params['invoiceid'];
    $amount = $params['amount'];
    # Format: ##.##
    $currency = $params['currency'];
    # Currency Code
    # Client Variables
    $firstname = $params['clientdetails']['firstname'];
    $lastname = $params['clientdetails']['lastname'];
    $email = $params['clientdetails']['email'];
    $address1 = $params['clientdetails']['address1'];
    $address2 = $params['clientdetails']['address2'];
    $city = $params['clientdetails']['city'];
    $state = $params['clientdetails']['state'];
    $postcode = $params['clientdetails']['postcode'];
    $country = $params['clientdetails']['country'];
    $phone = $params['clientdetails']['phonenumber'];
    # Build Bitcoin Information Here
    require_once 'bitcoin/jsonRPCClient.php';
    $bitcoin = new jsonRPCClient($rpc);
    if (!$bitcoin->getinfo()) {
        die('could not connect to bitcoind');
    }
    $address = $bitcoin->getaccountaddress($params['clientdetails']['userid'] . '-' . $invoiceid);
    # Enter your code submit to the gateway...
    $code = 'Send Payments to: ' . $address . '';
    return $code;
}
开发者ID:carriercomm,项目名称:WHMCS-Bitcoin-Payment-Module,代码行数:35,代码来源:bitcoin.php


示例4: AutoResponderGetResponseAPI

 function AutoResponderGetResponseAPI($that, $ar, $wpm_id, $email, $unsub = false)
 {
     global $wpdb;
     require_once $that->pluginDir . '/extlib/jsonRPCClient.php';
     if ($ar['campaign'][$wpm_id]) {
         $campaign = trim($ar['campaign'][$wpm_id]);
         $name = trim($that->ARSender['name']);
         $email = trim($that->ARSender['email']);
         $api_key = trim($ar['apikey']);
         $api_url = empty($ar['api_url']) ? "http://api2.getresponse.com" : trim($ar['api_url']);
         $grUnsub = $ar['grUnsub'][$wpm_id] == 1 ? true : false;
         $uid = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE `user_email`='" . esc_sql($that->ARSender['email']) . "'");
         $ip = trim($that->Get_UserMeta($uid, 'wpm_login_ip'));
         $ip = $ip ? $ip : trim($that->Get_UserMeta($uid, 'wpm_registration_ip'));
         $ip = $ip ? $ip : trim($_SERVER['REMOTE_ADDR']);
         try {
             if (!extension_loaded('curl') || !extension_loaded('json')) {
                 # these extensions are a must
                 throw new Exception("CURL and JSON are modules required to use" . " the GetResponse Integration");
             }
             $api = new jsonRPCClient($api_url);
             #get the campaign id
             $resp = $api->get_campaigns($api_key);
             $cid = null;
             if (!empty($resp)) {
                 foreach ($resp as $i => $item) {
                     if (strtolower($item['name']) == strtolower($campaign)) {
                         $cid = $i;
                     }
                 }
             }
             if (empty($cid)) {
                 throw new Exception("Could not find campaign {$campaign}");
             }
             if ($unsub) {
                 if ($grUnsub) {
                     //list contacts
                     $contacts = $api->get_contacts($api_key, array('campaigns' => array($cid), 'email' => array('EQUALS' => "{$email}")));
                     if (empty($contacts)) {
                         #could not find the contact, nothing to remove
                         return;
                     }
                     $pid = key($contacts);
                     $res = $api->delete_contact($api_key, array('contact' => $pid));
                     if (empty($res)) {
                         throw new Exception("Empty server response while deleting contact");
                     }
                 }
             } else {
                 $resp = $api->add_contact($api_key, array('campaign' => $cid, 'name' => $name, 'email' => $email, 'ip' => $ip, 'cycle_day' => 0));
                 if (empty($resp)) {
                     throw new Exception("Empty server response while sending");
                 }
             }
         } catch (Exception $e) {
             return;
         }
     }
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:59,代码来源:integration.autoresponder.getresponseapi.php


示例5: jsonRPCAct

 public function jsonRPCAct()
 {
     vendor('jsonRPC.jsonRPCClient');
     $client = new \jsonRPCClient('http://localhost:8500/Api/JsonRPCTest');
     $result = $client->test();
     var_dump($result);
     // 结果:
 }
开发者ID:dalinhuang,项目名称:hipi,代码行数:8,代码来源:IndexController.class.php


示例6: test

 /**
  * Simple procedure to test most RPC functions
  *
  */
 public function test()
 {
     $RPCType = Yii::app()->getConfig("RPCInterface");
     $serverUrl = Yii::app()->getBaseUrl(true) . '/' . dirname(Yii::app()->request->getPathInfo());
     $sFileToImport = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'docs' . DIRECTORY_SEPARATOR . 'demosurveys' . DIRECTORY_SEPARATOR . 'limesurvey2_sample_survey_english.lss';
     if ($RPCType == 'xml') {
         require_once 'Zend/XmlRpc/Client.php';
         $client = new Zend_XmlRpc_Client($serverUrl);
     } elseif ($RPCType == 'json') {
         Yii::app()->loadLibrary('jsonRPCClient');
         $client = new jsonRPCClient($serverUrl);
     }
     $sSessionKey = $client->call('get_session_key', array('admin', 'password'));
     if (is_array($sSessionKey)) {
         echo $sSessionKey['status'];
         die;
     } else {
         echo 'Retrieved session key' . '<br>';
     }
     $sLSSData = base64_encode(file_get_contents($sFileToImport));
     $iSurveyID = $client->call('import_survey', array($sSessionKey, $sLSSData, 'lss', 'Test import by JSON_RPC', 1000));
     echo 'Created new survey SID:' . $iSurveyID . '<br>';
     $aResult = $client->call('activate_survey', array($sSessionKey, $iSurveyID));
     if ($aResult['status'] == 'OK') {
         echo 'Survey ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $client->call('activate_tokens', array($sSessionKey, $iSurveyID, array(1, 2)));
     if ($aResult['status'] == 'OK') {
         echo 'Tokens for Survey ID ' . $iSurveyID . ' successfully activated.<br>';
     }
     $aResult = $client->call('set_survey_properties', array($sSessionKey, $iSurveyID, array('faxto' => '0800-LIMESURVEY')));
     if (!array_key_exists('status', $aResult)) {
         echo 'Modified survey settings for survey ' . $iSurveyID . '<br>';
     }
     $aResult = $client->call('add_language', array($sSessionKey, $iSurveyID, 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Added Arabian as additional language' . '<br>';
     }
     $aResult = $client->call('set_language_properties', array($sSessionKey, $iSurveyID, array('surveyls_welcometext' => 'An Arabian welcome text!'), 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Modified survey locale setting welcometext for Arabian in survey ID ' . $iSurveyID . '<br>';
     }
     $aResult = $client->call('delete_language', array($sSessionKey, $iSurveyID, 'ar'));
     if ($aResult['status'] == 'OK') {
         echo 'Removed Arabian as additional language' . '<br>';
     }
     //Very simple example to export responses as Excel file
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'xls'));
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'pdf'));
     //$aResult=$client->call('export_responses', array($sSessionKey,$iSurveyID,'doc'));
     $aResult = $client->call('export_responses', array($sSessionKey, $iSurveyID, 'csv'));
     //file_put_contents('test.xls',base64_decode(chunk_split($aResult)));
     $aResult = $client->call('delete_survey', array($sSessionKey, $iSurveyID));
     echo 'Deleted survey SID:' . $iSurveyID . '-' . $aResult['status'] . '<br>';
     // Release the session key - close the session
     $Result = $client->call('release_session_key', array($sSessionKey));
     echo 'Closed the session' . '<br>';
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:62,代码来源:remotecontrol.php


示例7: transactionLookup

 public static function transactionLookup($tx)
 {
     $wallet = new jsonRPCClient(HOTWALLET, true);
     $getRawTransaction = $wallet->getrawtransaction($tx);
     $decodeRawTransaction = $wallet->decoderawtransaction($getRawTransaction);
     $return['rawtransaction'] = $getRawTransaction;
     $return['transaction'] = $decodeRawTransaction;
     return $return;
 }
开发者ID:newmight2015,项目名称:BlockExplorer,代码行数:9,代码来源:blockchain.php


示例8: get_block_info

function get_block_info($block){
	require_once('/var/www/midas/root/private/class/jsonRPCClient.php');
	$darkcoin = new jsonRPCClient('http://xxxx:[email protected]:9998/');
	$hash_block = $darkcoin->getblockhash(intval($block));
	
	$info_block = $darkcoin->getblock($hash_block);
	$tx = $info_block["tx"][0];
	$diff = round($info_block["difficulty"]);
	$last_block = $block_id = $info_block["height"];
	$block_time = $info_block["time"];
	return $info_block;
}
开发者ID:Karasur,项目名称:dashpay.org.ru,代码行数:12,代码来源:func.php


示例9: sendToAddress

function sendToAddress($address, $amount)
{
    try {
        $amount = round($amount, 8);
        $bitcoin = new jsonRPCClient(kBitcoinURL);
        $txid = $bitcoin->sendtoaddress($address, floatval($amount));
        $log = new MessageLog('log', 255);
        $log->write("mywallet-bitcoin:{$address} BTC:{$amount} txid:{$txid}");
        return $txid;
    } catch (Exception $e) {
        return "Error: " . $e->getMessage();
    }
}
开发者ID:GeopaymeEE,项目名称:BitcoinATM-php,代码行数:13,代码来源:sendToAddress.php


示例10: search

/**
 * Return an array of objects representing search results.
 *
 * See: http://www.bugzilla.org/docs/4.2/en/html/api/Bugzilla/WebService/Bug.html#search
 *
 * @param array $params search fields => values
 * @return array of stdClass bug objects for given search
 * @return boolean false if search failed altogether (I think)
 */
function search(array $params)
{
    $client = new jsonRPCClient("https://bugzilla.wikimedia.org/jsonrpc.cgi");
    try {
        $result = $client->call('Bug.search', array($params));
    } catch (\Exception $e) {
        Fail::log($e);
        return false;
    }
    $bugs = array();
    for ($i = 0, $c = count($result[1]['bugs']); $i < $c; ++$i) {
        $bugs[] = (object) $result[1]['bugs'][$i];
    }
    return $bugs;
}
开发者ID:wikidata,项目名称:wikidata,代码行数:24,代码来源:index.php


示例11: indeed_getResponse

 public function indeed_getResponse($api_key, $token, $e_mail, $full_name = '')
 {
     require_once $this->dir_path . '/email_services/getresponse/jsonRPCClient.php';
     $api = new jsonRPCClient('http://api2.getresponse.com');
     $args = array('campaign' => $token, 'email' => $e_mail);
     if (!empty($full_name)) {
         $args['name'] = $full_name;
     }
     $res = $api->add_contact($api_key, $args);
     if ($res) {
         return 1;
     } else {
         return 0;
     }
 }
开发者ID:Juni4567,项目名称:meritscholarship,代码行数:15,代码来源:IhcMailServices.class.php


示例12: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = $this->config->get('config_currency');
     $bitcoin_btc_decimal = $this->config->get('bitcoin_btc_decimal');
     $bitcoin_total = $order['bitcoin_total'];
     $bitcoin_address = $order['bitcoin_address'];
     if (!$this->config->get('bitcoin_blockchain')) {
         require_once 'jsonRPCClient.php';
         $bitcoin = new jsonRPCClient('http://' . $this->config->get('bitcoin_rpc_username') . ':' . $this->config->get('bitcoin_rpc_password') . '@' . $this->config->get('bitcoin_rpc_address') . ':' . $this->config->get('bitcoin_rpc_port') . '/');
         try {
             $bitcoin_info = $bitcoin->getinfo();
         } catch (Exception $e) {
             $this->data['error'] = true;
         }
     }
     try {
         if (!$this->config->get('bitcoin_blockchain')) {
             $received_amount = $bitcoin->getreceivedbyaddress($bitcoin_address, 0);
         } else {
             static $ch = null;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Blockchain.info PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')');
             curl_setopt($ch, CURLOPT_URL, 'http://blockchain.info/q/getreceivedbyaddress/' . $bitcoin_address . '?confirmations=0');
             $res = curl_exec($ch);
             if ($res === false) {
                 throw new Exception('Could not get reply: ' . curl_error($ch));
             }
             $received_amount = $res / 100000000;
         }
         if (round((double) $received_amount, $bitcoin_btc_decimal) >= round((double) $bitcoin_total, $bitcoin_btc_decimal)) {
             $order = $this->model_checkout_order->getOrder($order_id);
             $this->model_checkout_order->confirm($order_id, $this->config->get('bitcoin_order_status_id'));
             echo "1";
         } else {
             echo "0";
         }
     } catch (Exception $e) {
         $this->data['error'] = true;
         echo "0";
     }
 }
开发者ID:blackchat,项目名称:OpenCart_Bitcoin,代码行数:45,代码来源:bitcoin.php


示例13: sendBtc

function sendBtc($id, $amount)
{
    #Send btc from id to address
    $bitcoin = new jsonRPCClient("http://{$bitcoin_user}:{$bitcoin_pass}@127.0.0.1:8332/");
    if ($bitcoin->getbalance() < $amount) {
        return -1;
    }
    if (!debit($id, $amount)) {
        return -2;
    }
    $address = getAddress($id);
    if ($address == -1) {
        return -3;
    }
    $comment = getUsernameById($id);
    $bitcoin->sendtoaddress($address, $amount, $comment);
    return 0;
}
开发者ID:henrikssn,项目名称:OpenPool,代码行数:18,代码来源:payment.php


示例14: process

 function process()
 {
     global $order;
     if (!$this->enabled) {
         return;
     }
     $client = new jsonRPCClient('http://api2.getresponse.com');
     $result = NULL;
     try {
         $result = $client->get_campaigns(MODULE_ORDER_TOTAL_GETRESPONSE_API_KEY, array('name' => array('EQUALS' => MODULE_ORDER_TOTAL_GETRESPONSE_CAMPAIGN)));
         if (empty($result)) {
             throw new Exception('Missing GetResponse campaign: ' . MODULE_ORDER_TOTAL_GETRESPONSE_CAMPAIGN);
         }
         $client->add_contact(MODULE_ORDER_TOTAL_GETRESPONSE_API_KEY, array('campaign' => array_pop(array_keys($result)), 'name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'], 'email' => $order->customer['email_address'], 'cycle_day' => '0', 'customs' => array(array('name' => 'ref', 'content' => STORE_NAME), array('name' => 'telephone', 'content' => $order->customer['telephone']), array('name' => 'country', 'content' => $order->customer['country']['title']), array('name' => 'city', 'content' => $order->customer['city']))));
     } catch (Exception $e) {
         error_log($e->getMessage());
         return;
     }
 }
开发者ID:roopesh21,项目名称:DevZone,代码行数:19,代码来源:ot_getresponse.php


示例15: subscribe_get_response

 /**
  * Subscribes to GetResponse list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_get_response($list, $email, $api_key, $name = '-')
 {
     if (!function_exists('curl_init')) {
         return;
     }
     require_once RAD_RAPIDOLOGY_PLUGIN_DIR . 'subscription/getresponse/jsonrpcclient.php';
     $api_url = 'http://api2.getresponse.com';
     $name = '' == $name ? '-' : $name;
     $client = new jsonRPCClient($api_url);
     $result = $client->add_contact($api_key, array('campaign' => $list, 'name' => $name, 'email' => $email));
     if (isset($result['result']['queued']) && 1 == $result['result']['queued']) {
         $result = 'success';
     } else {
         if (isset($result['error']['message'])) {
             $result = $result['error']['message'];
         } else {
             $result = 'unknown error';
         }
     }
     return $result;
 }
开发者ID:brett1776,项目名称:rapidology-plugin,代码行数:25,代码来源:class.rapidology-getresponse.php


示例16: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = "USD";
     $hazecoin_total = round($this->currency->convert($order['total'], $current_default_currency, "haze"), 4);
     require_once 'jsonRPCClient.php';
     $hazecoin = new jsonRPCClient('http://' . $this->config->get('hazecoin_rpc_username') . ':' . $this->config->get('hazecoin_rpc_password') . '@' . $this->config->get('hazecoin_rpc_address') . ':' . $this->config->get('hazecoin_rpc_port') . '/');
     try {
         $hazecoin_info = $hazecoin->getinfo();
     } catch (Exception $e) {
         $this->data['error'] = true;
     }
     $received_amount = $hazecoin->getreceivedbyaccount($this->config->get('hazecoin_prefix') . '_' . $order_id, 0);
     if (round((double) $received_amount, 4) >= round((double) $hazecoin_total, 4)) {
         $order = $this->model_checkout_order->getOrder($order_id);
         $this->model_checkout_order->confirm($order_id, $this->config->get('hazecoin_order_status_id'));
         echo true;
     } else {
         echo false;
     }
 }
开发者ID:HazeDev,项目名称:OpenCart_Hazecoin,代码行数:23,代码来源:hazecoin.php


示例17: litecoin_link

function litecoin_link($params)
{
    full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_payments` (`invoice_id` int(11) NOT NULL, `amount` float(11,8) NOT NULL, `address` varchar(64) NOT NULL, `confirmations` int(11) NOT NULL, PRIMARY KEY (`invoice_id`))");
    full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_info` (`invoice_id` int(11) NOT NULL, `secret` varchar(64) NOT NULL, `address` varchar(64) NOT NULL, PRIMARY KEY (`invoice_id`))");
    $q = mysql_fetch_array(mysql_query("SELECT * FROM `mod_gw_litecoin_info` WHERE invoice_id = '{$params['invoiceid']}'"));
    if ($q['address']) {
        $amount = $q['amount'];
        $address = $q['address'];
    }
    $secret = '';
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
    for ($i = 0; $i < 64; $i++) {
        $secret .= substr($characters, rand(0, strlen($characters) - 1), 1);
    }
    # Grab the amount and everything from BTC-e's ticker
    $ltc_ticker = json_decode(file_get_contents("https://btc-e.com/api/2/ltc_usd/ticker"), true);
    if (!$ltc_ticker) {
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $amount = round($params['amount'] / $ltc_ticker['ticker']['sell'], 8);
    # Build Litecoin Information Here
    require_once 'whmcscoin/jsonRPCClient.php';
    $litecoin = new jsonRPCClient("http://{$params['username']}:{$params['password']}@{$params['host']}:{$params['port']}");
    if (!$litecoin->getinfo()) {
        //This won't work. Gotta make this work.
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $address = $litecoin->getaccountaddress($secret);
    if (!$address) {
        //This probably won't work either.{
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $code = 'Please send <strong>' . $params['amount'] . '</strong>worth of LTC to address:<br /><strong><a href="#">' . $address . '</a></strong><br /><span id="ltcprice">Currently, ' . $params['amount'] . ' is <strong>' . $amount . '</strong> LTC</span>';
    mysql_query("INSERT INTO `mod_gw_litecoin_info` SET invoice_id = '{$params['invoiceid']}', address = '" . mysql_real_escape_string($address) . "', secret = '{$secret}'");
    return "<iframe src='{$params['systemurl']}/modules/gateways/litecoin.php?invoice={$params['invoiceid']}' style='border:none; height:120px'>Your browser does not support frames.</iframe>";
    return $code;
}
开发者ID:habibmasuro,项目名称:whmcscoin,代码行数:37,代码来源:litecoin.php


示例18: jsonRPCClient

ユーザー名:
<input type=text size="40" name="username" value=""><br />
<input type="submit" name="param" value="アドレス取得">
<input type="submit" name="param" value="入金チェック">
</form>
<?php 
require_once __DIR__ . '/jsonRPCClient.php';
$host = 'localhost';
/* monacoind 又は monacoin-qt を実行中のホストのアドレス */
$rpcuser = 'monacoinrpc';
/* monacoin.conf で指定した rpcユーザー名 */
$rpcpassword = 'aaaaa';
/* monacoin.conf で指定した rpcパスワード */
$rpcport = '4000';
/* monacoin.conf で指定した rpcポート */
$historyNum = 50;
/* 取得するトランザクション数 */
/* monacoind への接続アドレス */
$coindaddr = "http://{$rpcuser}:{$rpcpassword}@{$host}:{$rpcport}/";
$coind = new jsonRPCClient($coindaddr);
$info = $coind->getinfo();
echo "Balance: <div id=balance>{$info['balance']}</div>";
$list = $coind->listaccounts();
print_r($list);
?>
<div id="COUNTDOWN">0</div>
<div id="BTCMONA">wait</div>
</body>
</html>

开发者ID:you21979,项目名称:mona_sample,代码行数:29,代码来源:index.php


示例19: getGatewayVariables

include "../../../includes/invoicefunctions.php";
$gatewaymodule = "litecoin";
# Enter your gateway module name here replacing template
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
# Checks gateway module is active before accepting callback
# Gateway Specific Variables
$u = $GATEWAY['username'];
$p = $GATEWAY['password'];
$h = $GATEWAY['host'] . ':' . $GATEWAY['port'];
$rpc = 'http://' . $u . ':' . $p . '@' . $h;
# Build Litecoin Information Here
require_once '../litcoin/jsonRPCClient.php';
$litecoin = new jsonRPCClient($rpc);
if (!$litecoin->getinfo()) {
    die('could not connect to litcoind');
}
$sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"';
$results = mysql_query($sql);
while ($result = mysql_fetch_array($results)) {
    $amount = $result['total'];
    $btcaccount = $result['userid'] . '-' . $result['id'];
    $received = $litecoin->getbalance($btcaccount);
    //print($received);
    if ($amount <= $received) {
        //echo 'PAID';
        $fee = 0;
        $transid = $litecoin->getaccountaddress($btcaccount . '-' . $result['id']);
        //checkCbTransID($transid);
开发者ID:Artea,项目名称:WHMCS-Litecoin-Payment-Module,代码行数:31,代码来源:litcoin.php


示例20: getHouseBalance

 function getHouseBalance()
 {
     try {
         $bitcoind = new jsonRPCClient('http://' . $this->__get("username") . ':' . $this->__get("password") . '@' . $this->__get("btcserver") . ':' . $this->__get("btcport") . '/');
         $balance = $bitcoind->getbalance("bitsman");
         return $balance;
     } catch (Exception $e) {
         return 0;
     }
 }
开发者ID:djbakerman,项目名称:botjack,代码行数:10,代码来源:DanCoin.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP juri类代码示例发布时间:2022-05-23
下一篇:
PHP json类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap