Blockchain.info send may transactions API v2 I'm currently using v2 of Blockchain.info's API and am wanting to utilise "Send Many Transaction" and am having some issues.

I have 1 wallet with many addresses, I am trying to send 2 transactions within 1 payment, their API documentation is still from v1 and is missing the '&amp;from' from their api example, and have spent more time than I'd like to admit to get this working.

this is from there website:

http://localhost:3000/merchant/$guid/sendmany?password=$main_password&amp;second_password=$second_password&amp;recipients=$recipients&amp;fee=$fee

$main_password Your Main Blockchain wallet password
$second_password Your second Blockchain Wallet password if double encryption  is enabled.
$recipients Is a JSON Object using Bitcoin Addresses as keys and the amounts to send as values (See below).
$from Send from a specific Bitcoin Address (Optional)
$fee Transaction fee value in satoshi (Must be greater than default fee) (Optional)
$note A public note to include with the transaction -- can only be attached to transactions where all outputs are greater than 0.005 BTC.(Optional)


The result I get is:

failed to open stream:HTTP request failed!

Fatal error:Maximum execution time of 120 seconds exceeded

I now the url is wrong but can anyone please help advise me what it is specifically.

So far this is what I have

// Sending addresses 
$Address1 = 'Address1';
$Address2 = 'Address2';

//Amount coming from
$From = 'Address3';

//Amounts being sent in satoshi
$Amount1 = 100000;  // 0.001 of a btc
$Amount2 = 100000;  

$recipients = urlencode(' {
    "'.$Address1.'": '.$Amount1.',  
    "'.$Address2.'": '.$Amount2.'
}');

$Guid = 'MY_GUID';      
$Password = 'MY_PASSWORD';                              

$url = 'http://localhost:3000/merchant/'.$Guid.'/sendmany?password='.$Password.'&amp;from='.$From.'&amp;recipients='.$recipients.''; 
// I've also tried to remove $data and put '&amp;api_code=MY_API_CODE' after
// $recipients as this also works for other api calls for v2

$data = array('api_code' =&gt; 'MY_API_CODE');

$result = sendAmounts($url, $data);

function sendAmounts($url, $data) { 
$options = array(
    'http' =&gt; array(
        'header'  =&gt; "Content-type: application/x-www-form-urlencoded\r\n",
        'method'  =&gt; 'POST',  // Also tried GET
        'content' =&gt; http_build_query($data),
    ),
);
$context  = stream_context_create($options);
$result = file_get_contents($url, false, $context);

return $result;
}


Thank you in advance.
As of January 2016 Blockchain.info made changes to the wallet API service that now requires you to run a local nodeJS service to handle the calls. This will require you to have root access to your webserver so you will need to use a VPS instead of a basic shared web host. 

Also I don't recommend hand-coding the JSON yourself when using sendmany. Instead create an array and then use the json_encode function.

$array = array(
    "1someAddress" =&gt; 20000,
    "1someAddress2" =&gt; 150000,
    "1someAddress3" =&gt; 314159
); 
$addresses = json_encode($array);


You're not the only one that has hard time with the new version of their API. If you still need some help check out these resources. 

https://www.youtube.com/watch?v=X8jsaf4sEgs
http://btcthreads.com/how-to-setup-blockchain-wallet-service/ 

I started a PHP library for communicating with the nodeJS service, (still needs work, some functions are missing) https://github.com/coinables/blockchain-wallet-APIv2-PHP-Library