Author

Topic: help sendmany - php (Read 960 times)

legendary
Activity: 3332
Merit: 3116
October 02, 2014, 12:47:50 PM
#2
This code work for me:

Code:
#!/bin/bash
#Guid
gu="xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"
#Blockchain password
pas="xxxxxxxxxx"
green="1LuckyG4tMMZf64j6ea7JhCz7sDpk6vdcS"
yellow="1LuckyY9fRzcJre7aou7ZhWVXktxjjBb9S"
red="1LuckyR1fFHEsXYyx5QK4UFzv3PEAepPMK"
BTCg="250000"
BTCy="150000"
BTCr="100000"
curl "https://blockchain.info/merchant/$gu/sendmany?password=$pas&recipients=%7B%22$green%22%3A$BTCg%2C%22$yellow%22%3A$BTCy%2C%22$red%22%3A$BTCr%7D&shared=false&fee=10000"
newbie
Activity: 24
Merit: 0
March 19, 2014, 12:11:13 PM
#1
I am trying to write a script to send many but i keep getting a error return of

"Invalid Recipients JSON. Please make sure it is url encoded and consult the docs."

Code:
this is where i encode the array which KEY = BTCAddress, Value = BTCAmount
$json_encode = json_encode($this->PayoutJSON);

this is where i url encode the json encoded array
$recipients = urlencode($json_encode);

then this is how i send.
$json_url = "https://blockchain.info/merchant/$GUID/sendmany?password=$FPASSWORD&second_password=$SPASSWORD&recipients=$recipients";
$json_data = file_get_contents($json_url);
$json_feed = json_decode($json_data);

Jump to: