Bitcoin Forum
May 07, 2024, 01:19:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [FIXED] PHP RPC code spits out question marks and then dosent do anything.  (Read 1832 times)
Anonymous
Guest

July 20, 2011, 04:49:37 PM
Last edit: July 22, 2011, 08:04:09 AM by Gavin Andresen
 #1

Hi,
I have the following code below that is designed to send bitcoins to a certain address from php, using json rpc in php.
Code:
<?php
//send bitcoins
require "jsonRPCClient.php";

 
  
$bitcoin = new jsonRPCClient('http://username:password@127.0.0.1:8332/');
 
  
$bitcoin->sendtoaddress("1KxMF3DbtCu7DqXr5FUeG52U14vm8zyZwE 0.01");
?>

But my code always spits out:
Code:
 "?????????????????????????????????????????????????????????????????????????????????????????????????E??????"

I also tried
Code:
<?php
//send bitcoins
require "jsonRPCClient.php";

 
  
$bitcoin = new jsonRPCClient('http://username:password@127.0.0.1:8332/');
 
  
$bitcoin->sendtoaddress("1KxMF3DbtCu7DqXr5FUeG52U14vm8zyZwE"0.01);
?>

But still get the same output. What is going on, and how can I fix it.
1715044772
Hero Member
*
Offline Offline

Posts: 1715044772

View Profile Personal Message (Offline)

Ignore
1715044772
Reply with quote  #2

1715044772
Report to moderator
1715044772
Hero Member
*
Offline Offline

Posts: 1715044772

View Profile Personal Message (Offline)

Ignore
1715044772
Reply with quote  #2

1715044772
Report to moderator
Even if you use Bitcoin through Tor, the way transactions are handled by the network makes anonymity difficult to achieve. Do not expect your transactions to be anonymous unless you really know what you're doing.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715044772
Hero Member
*
Offline Offline

Posts: 1715044772

View Profile Personal Message (Offline)

Ignore
1715044772
Reply with quote  #2

1715044772
Report to moderator
Anonymous
Guest

July 20, 2011, 10:18:45 PM
 #2

Hi,
I have the following code below that is designed to send bitcoins to a certain address from php, using json rpc in php.
Code:
<?php
//send bitcoins
require "jsonRPCClient.php";

 
  
$bitcoin = new jsonRPCClient('http://username:password@127.0.0.1:8332/');
 
  
$bitcoin->sendtoaddress("1KxMF3DbtCu7DqXr5FUeG52U14vm8zyZwE 0.01");
?>

But my code always spits out:
Code:
 "?????????????????????????????????????????????????????????????????????????????????????????????????E??????"

I also tried
Code:
<?php
//send bitcoins
require "jsonRPCClient.php";

 
  
$bitcoin = new jsonRPCClient('http://username:password@127.0.0.1:8332/');
 
  
$bitcoin->sendtoaddress("1KxMF3DbtCu7DqXr5FUeG52U14vm8zyZwE"0.01);
?>

But still get the same output. What is going on, and how can I fix it.

Doesn't anyone know what is going on? (:
drawoc
Full Member
***
Offline Offline

Activity: 168
Merit: 100

Firstbits: 175wn


View Profile
July 21, 2011, 05:11:36 AM
 #3

I don't have a clue what's wrong, but I'd just like to point out that your second example is more correct than the first.

Maybe if you simplified it even more it would help track down the problem? Instead of trying to send something, just:
print_r($bitcoin->getinfo());

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
Anonymous
Guest

July 21, 2011, 05:36:04 AM
 #4

I don't have a clue what's wrong, but I'd just like to point out that your second example is more correct than the first.

Maybe if you simplified it even more it would help track down the problem? Instead of trying to send something, just:
print_r($bitcoin->getinfo());

I rewrote the code, and it works now, I do not know what may have been the problem, but it works now after I started fresh... You were right, the second example was correct. Thanks for responding...
drawoc
Full Member
***
Offline Offline

Activity: 168
Merit: 100

Firstbits: 175wn


View Profile
July 21, 2011, 06:23:12 PM
 #5

I rewrote the code, and it works now, I do not know what may have been the problem, but it works now after I started fresh... You were right, the second example was correct. Thanks for responding...

Glad you've got this working now.

Donate: 175WNXmJ1WVhFgVGKUqEhYtAQGRYAvqPA
Anonymous
Guest

August 12, 2011, 02:12:22 AM
 #6

Figured it out. My php was the problem. I saved the file with UTF-8 encoding, but I really should have saved it with UTF-16 encoding. I found this out when I wrote another php script for an unrelated project, and I got the same error. It was only on my mac. This fix works every time. Sorry to bother bitcoin about this  Smiley
Inaba
Legendary
*
Offline Offline

Activity: 1260
Merit: 1000



View Profile WWW
August 13, 2011, 10:43:41 PM
 #7

I thought Macs "Just Work?"


If you're searching these lines for a point, you've probably missed it.  There was never anything there in the first place.
Anonymous
Guest

August 13, 2011, 10:48:47 PM
 #8

I thought Macs "Just Work?"


HA! Yah Right. If I had bitnickel every time I broke that phrase wide open, then I would be a millionaire
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!