Personally I think you should use blockchain.info's receive payments API if you want to create addresses on the fly without running bitcoind.
More info:
https://blockchain.info/api/api_receiveWhat kind of site are you running and why are they depositing? If you are keeping track of balances you'll need to run a database.
If you just want to accept payments for something you can just have them fill out a form with their name.
This can be your buy page, save as buy.php
$secret = "1234abcd"; //secret can be anything you want it's intended to prevent hackers trying to spoof your callback
$my_address = "1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj"; //Replace this with your BTC address, payments will get forwarded here
$username = $_POST['username'];
$callback = "http://yourdomain.com/callback.php?user=".$username."&secret=".$secret; //change to your domain
if(isset($_POST['submit'])){
$response = json_decode(file_get_contents("https://blockchain.info/api/receive?method=create&address=".$my_address."&callback=".urlencode($callback)), true);
$sendPmt = "Send your payment to ".$response["input_address"];
}
?>
echo $sendPmt; ?>
Below can be your callback page, save as callback.php. It will send you an email that payment was received and notify blockchain.info it was received by your web server with *ok*
$secret = "1234abcd"; //This needs to match your other secret from the buy page
//checks to make sure secret matches
if($_GET['secret'] != $secret){
echo "Quit hacking hacker!";
return;
}
//send yourself an email to notify that payment was received
$youremail = "[email protected]";
$emailtitle = $_GET['user'];
$body = "Invoice paid";
$headers = "From: [email protected]" ."\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($youremail, $emailtitle, $body, $headers);
//notifies blockchaininfo that you received the callback
if ($mail) {
echo "*ok*";
}
?> There's also this video that might help.
https://www.youtube.com/watch?v=vWt9wRZ3Hhk