This is solved now, if you want you can have a look on https://bitcointalk.org/index.php?topic=412425.0So I have installed daemon of bicoin litecoin and dogecoin on the same server all three of them are up and running but bitcoin daemon does not reply anything when I run bitcoind getinfo may be network issues or something like that. I have installed php on the same server and created a index.php file in /var/www/ folder
content of index.php file :
<?php
include_once('Bitcoin.php');
include_once('jsonRPCClient.php');
$dogecoin = new jsonRPCClient('http://user:pass@localhost:8332/');
print_r($dogecoin->getinfo());
?>
content of Bitcoin.php :
<?php
class Bitcoin (
// @var string
private $username;
// @var string
private @password;
// @var string
private $url;
// @var string
private $id;
public function __construct($url,$username,$password)
{
$this->url=$url;
$this->username = $username;
$this->password = $password;
$this->id = 1;
}
public function __call($method,$params)
{
$params = array_values($params);
$request = json_encode(array(
'method' =>strtolower($method),
'params' => $params,
'id' => $this-> id));
$curl = curl_init();
curl_setopt($curl,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, Array("Content type:application/json"));
curl_setopt($curl, CURLOPT_URL, $this->url);
curl_setopt($curl, CURLOPT_USERPWD, $this->username.":".$this->password);
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($curl);
curl_close($curl);
if(!$resposne)
{
throw new Exception('Unable to connect to '.$this->url, 0);
}
$response = json_decode($response,true);
}
then there are condition to throw different error upon different situation
}