Bitcoin Forum

Bitcoin => Project Development => Topic started by: wildboy211 on September 14, 2011, 06:35:08 AM



Title: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: wildboy211 on September 14, 2011, 06:35:08 AM
The problem:
Users need to deposit money on my site, im using bitcoinnotify.com and when users send money to one of my addresses, bitcoinnotify sends a HTTP POST to my url with deposit information. I created a simple page just to see what information bitcoinnotify.com was sending me, and all im getting is blank pages. The code im using is:
<?
print_r($_POST);
?>

Ive also created a "test" page and created a POST form and sent it to the deposit page, which showed the information.

What i need:
I dont specifically need to use bitcoinnotify.com and if there is a easier way, then i would use that. Ill pay for whoever figure out how i can get deposits and my server recognizes it so it shows in the user account.

I may up the ante if i see it needs it, but .80 is all i have in my account ATM.

BTW, i may need more work done...


Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: dogisland on September 14, 2011, 07:38:59 AM
Have a look at your apache logs. You should see the requests coming in from BitcoinNotify.



Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: Bitsky on September 14, 2011, 08:17:46 AM
You're seeing a blank page because you don't send any POST data. The reply to bitcoinnotify's request would contain the POST data in its reply.

If you need to see the data, your script needs to log it. You can simply dump it into a file:

Code:
<?php
$f
=fopen('/path/to/logs/bitcoinnotify.log''a');
fwrite($f"[".date('r')."]: data received\n");
fwrite($f': POST: '.print_r($_POSTtrue));
fclose($f);
?>


Remember that, depending on your config, you might have to adjust the permissions on the log file so that your webserver can write to it.


Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: hamburger on September 14, 2011, 08:43:34 AM
Hi,

First create a file output.txt and chmod it 777


Then create a file test.php or whatever you want to name it and past this code in it;

Code:
<?php

    $output 
file_get_contents('php://input');

    
$fp=fopen($tmp_path."output.txt","a");
    if(
$fp) {
      if(
flock($fp,LOCK_EX)) {
        
fwrite($fp,$output."\n");
        
flock($fp,LOCK_UN);
      }
      
fclose($fp);
    }

?>

Send notifications to this file and the result should be recorded in output.txt

Just adjust the file names and paths to make it secure to receive your notifications - also have a look at http://www.bitcoinpayflow.com/ as alternative or back up notification or complimentary notification to enhance your security. 

Hamburger


Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: wildboy211 on September 14, 2011, 01:14:45 PM
Hamburger and bitsky, both of those worked, so im going to split the reward because bitsky got to it first, and hamburger also showed me a great alternative to bitcoinnotify. Please PM or reply with your bitcoin addresses.
Thank you guys!


Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: wildboy211 on September 14, 2011, 01:16:57 PM
Bitsky, your address was in your sig, so i sent the coin to that address.


Title: Re: .80 to whoever can help me figure this out. (Deposits w/ PHP)
Post by: Bitsky on September 14, 2011, 03:11:46 PM
Thanks!