JSON RPC“无效的有效负载”消息“

I am trying to make some calls to my bitcoin wallet using the API provided at (https://blockchain.info/api/json_rpc_api)

I am using the PHP wrapper files from the site given above.

I am trying to call the can_connect method to make sure all my parameters are right, bit it returns as

Invalid return payload: enable debugging to examine incoming payload Invalid data

Looking at the files, I see there are both xmlrpc and jsonrpc includes. I am curious if the wrong one is being called ?

My code:

    <?php
include "AuctionFunctions.inc.php";

$btc = getConnection();
$canConnect = $btc->can_connect();
//echo $canConnect;
printf($canConnect);

//if ($canConnect) {
//  $status = setup();
//  echo $status;
//}
?>

this method should return a boolean value. Instead, this is what it returns (I enabled debug mode like the initial error said to do)

Note: I tried the advice at https://github.com/mikegogulski/bitcoin-php/issues/7 However, that did not fix the problem.

---GOT--- HTTP/1.1 200 OK Date: Thu, 11 Sep 2014 05:32:45 GMT Server: Apache Last-Modified: Wed, 19 Sep 2012 21:23:04 GMT Accept-Ranges: bytes Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 92 Connection: close Content-Type: text/html

‹³QÔÕU(HLOÍÏVÐÕµã²ñsó€") I• ¥©% º ùÅ%™yéɹÅF•%¹9@ª (Õb€>ˆÍe£‘ª–>L[ ---END---

HEADER: date: Thu, 11 Sep 2014 05:32:45 GMT HEADER: server: Apache HEADER: last-modified: Wed, 19 Sep 2012 21:23:04 GMT HEADER: accept-ranges: bytes HEADER: vary: Accept-Encoding HEADER: content-encoding: gzip HEADER: content-length: 92 HEADER: connection: close HEADER: content-type: text/html

---INFLATED RESPONSE---[91 chars]---

pageok

---END---

Invalid return payload: enable debugging to examine incoming payload Invalid data

the getConnection() method is in the AuctionFunctions.inc.php file which is included in the file which calls it. AuctionFunctions contains the method as shown:

function getConnection() {
$scheme = 'http';
$username = 'username here';
$password = 'password here';
$addresss = 'rpc.blockchain.info';
$port = '80';
$certificate_path = '';
$debug_level = 2;   
$btc = new BitcoinClient($scheme, $username, $password, $address = "localhost", $port = 80, $certificate_path, $debug_level);

return $btc; //returns BitcoinClient object

}

the BitcoinClient class is stored in a file called bitcoin.inc, and can be downloaded here: https://github.com/mikegogulski/bitcoin-php

douyu9433
douyu9433 我会更新问题以向您展示
接近 6 年之前 回复
doumu6997
doumu6997 信息不足。getConnection()做什么?比特币-php中没有这样的功能。我假设你的AuctionFunctions.inc.php文件中有一些东西用一组参数调用新的BitcoinClient(....),但你不在这里分享它们。你的要求是什么样的?
接近 6 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐