共享主机上的区块链钱包服务

时间:2021-01-28 18:18:57

标签: php node.js blockchain blockchain.info-api

我在 Namecheap 上有一个共享主机。可以运行节点应用程序。我想在此主机上安装区块链钱包服务并使用 Php Curl 功能访问该服务。为了进行区块链钱包相关的操作,Curl 函数必须向 http://localhost:3000 发送请求。在此端口上,假定服务运行。
我在主机的根目录上创建了一个文件夹。我将 index.js 文件和 package.json 文件放入该文件中。安装了区块链钱包服务。 index.js 中的以下代码运行服务:

const port = 3000;
const server = app.listen(port, () => {
    console.log('Server started at port: ' + port);
    shell.exec('blockchain-wallet-service start --port 3000', {async: true});
});

在 Cpanel 上似乎没有错误。使用下面的 PHP 代码,

$url = "http://localhost:3000/merchant/" . $this->blockchainGuid . "/balance?password=" . $this->blockchainPass;
        $res = $this->helper->curl($url);
        return round(($res['balance'] / 100000000), 8);

我尝试访问该服务。但我没有结果。 在我无缝地在 VPS 上运行此代码之前。但现在我想让它在 Namecheap 上运行。 是否有可能?如果是,怎么办?

0 个答案:

没有答案
相关问题