Prompting an account name I made an account "hello" in bitcoin daemon and wanted to run this. Whenever i put in hello when prompted, getac1 would return empty array; whereas, getac2 and getac3 returns addresses associated with account hello. What am I missing?
Assume I put in proper username, password, ip address, and port.

&lt;?php
require('easybitcoin.php');
$bitcoin = new Bitcoin("username", "password", "ip address", "8332");
//prompt function
function prompt($prompt_msg){
   echo("&lt;script type='text/javascript'&gt; var answer = prompt('".$prompt_msg."'); &lt;/script&gt;");
   $answer = "&lt;script type='text/javascript'&gt; document.write(answer); &lt;/script&gt;";
   return($answer);
}

//program
$prompt_msg = "Please enter account name";
$name = prompt($prompt_msg);

$getac1 = $bitcoin-&gt;getaddressesbyaccount($name);
$getac2 = $bitcoin-&gt;getaddressesbyaccount("hello");
$getac3 = $bitcoin-&gt;getaddressesbyaccount(hello);

print_r($getac1);
print_r($getac2);
print_r($getac3);
print_r($name);
echo "&lt;/pre&gt;";
?&gt;
This looks like a subtle issue with the code you are using and I do not think you are taking a sensible approach to getting the name back from the input. The javascript will not execute inside of your PHP, it only runs when sent to the browser.

When it executes your function prompt is called but the return is everything inside the quotes on line 7, which is not what you typed into the input but is exactly what is inside the quotes:


$answer = "&lt;script type='text/javascript'&gt; document.write(answer); &lt;/script&gt;";



I should ask, in what mode are you executing or calling your PHP - PHP can be executed standalone or it can execute with a browser page request.

I would solve this in a very rudimentary fashion by creating a HTML form which only displays if some $POST option is not set with the input, setting up the form to post back to the same URL and checking first for the $POST data as said. Then, if the $POST data is set, go ahead and create the output page - all in the one PHP file.