Bitcoin Forum
May 03, 2024, 06:20:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP connecting to Bitcoin (Solved)  (Read 1493 times)
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
April 20, 2013, 04:23:44 PM
Last edit: April 25, 2013, 04:21:59 PM by madmadmax
 #1

I am using:

Code:
<?php

 
require_once 'jsonRPCClient.php';
 
  
$client = new jsonRPCClient('http://user:pass@ip:8334/');
  
print_r($client->getinfo());
?>

And getting the error Incorrect response id (request id: 1, response id: ) even though I can connect through my own ip using Google Chrome.

Bitcoind has * in the settings for allow ip at the moment








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


1714717216
Hero Member
*
Offline Offline

Posts: 1714717216

View Profile Personal Message (Offline)

Ignore
1714717216
Reply with quote  #2

1714717216
Report to moderator
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714717216
Hero Member
*
Offline Offline

Posts: 1714717216

View Profile Personal Message (Offline)

Ignore
1714717216
Reply with quote  #2

1714717216
Report to moderator
1714717216
Hero Member
*
Offline Offline

Posts: 1714717216

View Profile Personal Message (Offline)

Ignore
1714717216
Reply with quote  #2

1714717216
Report to moderator
jon@bitcoinads.com
Newbie
*
Offline Offline

Activity: 18
Merit: 0


View Profile
April 21, 2013, 03:16:29 AM
 #2

Can you run the script on the machine running bitcoind to isolate the allowip setting? Maybe this is not the issue if you can connect from Chrome...

I would add a try catch around the block and check out any details of an exception.

try {
   ...
} catch (Exception $e){
   echo $e;
}

Be careful though this might print your connection details...
minzie
Member
**
Offline Offline

Activity: 110
Merit: 10



View Profile WWW
April 24, 2013, 10:08:33 PM
 #3

I am not sure if you found your solution yet, but it is not clear to me what it is you can connect to using Google Chrome. You are using PHP, so are you trying to run the PHP script from the command line, or from a browser that is not Google Chrome?

Professional Freelance Web Apps Engineer ° Portfolio °  ModoBot Automated Trading Platform ° BitThingy ° My Github  ° Skype: cclites_1
scintill
Sr. Member
****
Offline Offline

Activity: 448
Merit: 254


View Profile WWW
April 24, 2013, 10:19:51 PM
 #4

it is not clear to me what it is you can connect to using Google Chrome

I think he's saying if he puts the JSON-RPC HTTP addresses into Chrome, he gets some kind of response showing bitcoind is indeed listening on that IP and port.

1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
April 24, 2013, 11:18:48 PM
 #5

Had to sent a message to my host to open the port in the end, thanks for all the help guys.








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


Xenland
Legendary
*
Offline Offline

Activity: 980
Merit: 1003


I'm not just any shaman, I'm a Sha256man


View Profile
April 25, 2013, 01:49:26 AM
 #6

Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
April 25, 2013, 08:14:30 AM
Last edit: April 25, 2013, 04:22:33 PM by madmadmax
 #7

Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com

10,000$ for something that already exists, amazing.








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


Xenland
Legendary
*
Offline Offline

Activity: 980
Merit: 1003


I'm not just any shaman, I'm a Sha256man


View Profile
April 25, 2013, 01:34:23 PM
 #8

Also you can simplify things by using my library (still in development but i always push out stables releases) http://BitcoinDevKit.com

100,000$ for something that already exists, amazing.

That made no sense
stergium
Hero Member
*****
Offline Offline

Activity: 655
Merit: 500



View Profile
April 25, 2013, 01:58:17 PM
 #9

i am using
rpcallowip=192.168.*.*
rpcport=8332
on conf
and on php part

require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');

i make my calls to api like this
$b->getbalance('*',0);

hope that helps
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
April 25, 2013, 04:22:58 PM
 #10

i am using
rpcallowip=192.168.*.*
rpcport=8332
on conf
and on php part

require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');

i make my calls to api like this
$b->getbalance('*',0);

hope that helps

It's already solved but thanks for the effort, that's what counts  Wink








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!