Bitcoin Forum
April 25, 2024, 03:52:57 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 »  All
  Print  
Author Topic: How to use Walletnotify?  (Read 19008 times)
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
May 12, 2013, 11:49:35 PM
Merited by ABCbits (1)
 #1

How do you post or get using walletnotify?








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


1714017177
Hero Member
*
Offline Offline

Posts: 1714017177

View Profile Personal Message (Offline)

Ignore
1714017177
Reply with quote  #2

1714017177
Report to moderator
1714017177
Hero Member
*
Offline Offline

Posts: 1714017177

View Profile Personal Message (Offline)

Ignore
1714017177
Reply with quote  #2

1714017177
Report to moderator
1714017177
Hero Member
*
Offline Offline

Posts: 1714017177

View Profile Personal Message (Offline)

Ignore
1714017177
Reply with quote  #2

1714017177
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714017177
Hero Member
*
Offline Offline

Posts: 1714017177

View Profile Personal Message (Offline)

Ignore
1714017177
Reply with quote  #2

1714017177
Report to moderator
1714017177
Hero Member
*
Offline Offline

Posts: 1714017177

View Profile Personal Message (Offline)

Ignore
1714017177
Reply with quote  #2

1714017177
Report to moderator
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
May 13, 2013, 11:24:42 AM
Merited by ABCbits (4)
 #2

If you are talking about the -walletnotify config option in 0.8.2rc1, it works exactly like -blocknotify.  You specify the path to a program to be run.

The program will be run with a single argument (the transaction hash) when a new transaction hits your wallet.  Actually, it will run once or twice per transaction.  First time will be if you receive that transaction as a transaction, and the second time when you receive it as part of a block.

That program can be a script that uses some other tool (curl, wget, whatever) to issue a call out to an external webservice, or it can do whatever you need directly (update a database, logfile, etc).

If you are a high volume site that gets lots of transactions, you may need to be careful with it.  It can spawn a lot of new processes, so you should make your script fast and simple.  Just dump the txhash to a journal file (or table) and exit, for example, with a cron job to come around later to collect and process them in batches.

People were looking for a simple way to track incoming transactions, and this was the easiest way to do it.  It has some quirks, but it is still vastly superior to the hacks people were having to use before.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
May 13, 2013, 01:56:16 PM
 #3

If you are talking about the -walletnotify config option in 0.8.2rc1, it works exactly like -blocknotify.  You specify the path to a program to be run.

The program will be run with a single argument (the transaction hash) when a new transaction hits your wallet.  Actually, it will run once or twice per transaction.  First time will be if you receive that transaction as a transaction, and the second time when you receive it as part of a block.

That program can be a script that uses some other tool (curl, wget, whatever) to issue a call out to an external webservice, or it can do whatever you need directly (update a database, logfile, etc).

If you are a high volume site that gets lots of transactions, you may need to be careful with it.  It can spawn a lot of new processes, so you should make your script fast and simple.  Just dump the txhash to a journal file (or table) and exit, for example, with a cron job to come around later to collect and process them in batches.

People were looking for a simple way to track incoming transactions, and this was the easiest way to do it.  It has some quirks, but it is still vastly superior to the hacks people were having to use before.

Cron job lol, it's subbitcoin level security that might fly with Paypal or banks that don't care that their accounts with tens of thousands of dollars are being sold for 100 bucks on the darknet...








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
May 13, 2013, 02:27:25 PM
 #4

Cron job lol, it's subbitcoin level security that might fly with Paypal or banks that don't care that their accounts with tens of thousands of dollars are being sold for 100 bucks on the darknet...

I've read this four times now, and I still don't know what you are trying to say.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
May 13, 2013, 05:50:54 PM
 #5

Cron job lol, it's subbitcoin level security that might fly with Paypal or banks that don't care that their accounts with tens of thousands of dollars are being sold for 100 bucks on the darknet...

I've read this four times now, and I still don't know what you are trying to say.

Nevermind, can you please provide a sample of setting up walletnotify to execute an app?








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
May 13, 2013, 07:20:24 PM
Merited by ABCbits (4)
 #6

On the server I used for testing, in my bitcoin.conf:
Code:
walletnotify=/home/btcdev/walletnotify.sh %s
blocknotify=/home/btcdev/blocknotify.sh %s

The %s in the command line gets replaced with the (ASCII) hex string of the transaction hash, just like -blocknotify replaces it with the block hash.

And the program can be as simple or as complicated as you like.  Here is a simple shell script:

Code:
#!/bin/bash
F=/home/btcdev/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}

which gives lines like:

Code:
20130513123015 - 6fa6c8ff08f122327b7a0a329d7632f243038f0fc96cce1248cb4948d0509ecf

You aren't limited to shell scripts, of course.

A pipe would have been better, but they aren't portable.  Even if we had been willing to limit it to just UNIX-ish systems, there would have been horrible locking problems, and these notices simply weren't worth the effort to work around them*.  If you want similar behavior, you can fake a pipe with netcat, so that you could have a long running service that accepts TCP connections from localhost, and just call netcat to dump the txid to that socket.

Did you know that named pipes can stall in both directions, potentially DOSing one of the client threads?  There are ways around it, of course, but you have to throw out a lot of the abstractions, so there would have been a very un-C++ chunk of code in the bitcoin client, just for dealing with the pipes.  At least that was how it looked to me when I was researching it.  I don't do much with C++, so I'm hoping that someone in the audience is more skilled than I am, and will read this and say "You dumbass, why didn't you just do X?", or even better, rewrite it for me.  Smiley

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
madmadmax (OP)
Hero Member
*****
Offline Offline

Activity: 740
Merit: 501



View Profile
May 16, 2013, 05:44:18 PM
 #7

On the server I used for testing, in my bitcoin.conf:
Code:
walletnotify=/home/btcdev/walletnotify.sh %s
blocknotify=/home/btcdev/blocknotify.sh %s

The %s in the command line gets replaced with the (ASCII) hex string of the transaction hash, just like -blocknotify replaces it with the block hash.

And the program can be as simple or as complicated as you like.  Here is a simple shell script:

Code:
#!/bin/bash
F=/home/btcdev/wallet_transaction_log
D=`date +"%Y%m%d%H%M%S"`
echo ${D} - ${1} >> ${F}

which gives lines like:

Code:
20130513123015 - 6fa6c8ff08f122327b7a0a329d7632f243038f0fc96cce1248cb4948d0509ecf

You aren't limited to shell scripts, of course.

A pipe would have been better, but they aren't portable.  Even if we had been willing to limit it to just UNIX-ish systems, there would have been horrible locking problems, and these notices simply weren't worth the effort to work around them*.  If you want similar behavior, you can fake a pipe with netcat, so that you could have a long running service that accepts TCP connections from localhost, and just call netcat to dump the txid to that socket.

Did you know that named pipes can stall in both directions, potentially DOSing one of the client threads?  There are ways around it, of course, but you have to throw out a lot of the abstractions, so there would have been a very un-C++ chunk of code in the bitcoin client, just for dealing with the pipes.  At least that was how it looked to me when I was researching it.  I don't do much with C++, so I'm hoping that someone in the audience is more skilled than I am, and will read this and say "You dumbass, why didn't you just do X?", or even better, rewrite it for me.  Smiley

So basically, I can write a quick C# app to send a udp packet to the local host and listen there with the server. I am wondering what is the DDoS potential of such an attack?








       ▄▄▄▄▄               ▄▄▄▄▄
   ▄▄█▀▀▀▀▀▀██▄        ▄▄█▀▀▀▀▀▀▀█▄
 ▄██▀        ▀██▄    ▄██▀         ▀█▄
██▀            ▀██▄  ▀▀             ██
██               ▀██        ▄▄▄▄▄▄▄▄██
██                ▀██▄      ▀▀▀▀▀▀▀▀▀▀
 ██▄          ▄██   ▀██▄          ▄▄▄
  ▀██▄      ▄██▀      ▀██▄▄     ▄██▀
    ▀▀██████▀▀          ▀▀██████▀▀


Unchained Smart Contracts
Decentralized Oracle
Infinitly Scalable
Blockchain Technology
Turing-Complete
State-Channels



                 ▄████▄▄    ▄
██             ████████████▀
████▄         █████████████▀
▀████████▄▄   █████████████
▄▄█████████████████████████
██████████████████████████
  ▀██████████████████████
   █████████████████████
    ▀█████████████████▀
      ▄█████████████▀
▄▄███████████████▀
   ▀▀▀▀▀▀▀▀▀▀▀

             ▄██▄
     ▄      ▐████   ▄▄
   █████     ██████████
    █████████████████▀
 ▄████████████▀████▌
██████████     ▀████    
 ▀▀   █████     ██████████
      ▀████▌▄████████████▀
    ▄▄▄███████████████▌
   ██████████▀    ▐████
    ▀▀▀  ████▌     ▀▀▀
         ▀███▀
f


kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
May 17, 2013, 12:50:20 AM
 #8

DDOS?  zero.  There is no amplification, no redirection.

Someone can try to DOS you.  But it'll be expensive.  Your node will spawn a process for each transaction that hits your wallet, not for each output.  You should strive to make the spawned process as light and short lived as possible, but for the most part, there isn't much danger.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
inca
Legendary
*
Offline Offline

Activity: 1176
Merit: 1000


View Profile
December 15, 2013, 01:15:39 AM
 #9

Hi,

I am trying to use the -walletnotify option to run a php script which updates a log file/sql db with transaction id of new transaction affecting wallet.

For some reason I cannot get it working. I am using bitcoin version 80100.

I have tried this in my bitcoin.conf:

walletnotify=php /home/blahblah/Downloads/btcdev/walletnotify.php %s

and..

walletnotify="php /home/blahblah/Downloads/btcdev/walletnotify.php %s"


and also run bitcoind with and without the walletnotify commandline options: bitcoind -datadir=/home/blahblah/Downloads/testnet -testnet -debug -printtoconsole -walletnotify=php /home/blahblah/Downloads/btcdev/walletnotify.php %s

I can see the new transactions coming in but neither bitcoin-qt or bitcoind seem to try to run my script or error.

Any suggestions? Grin

Inca
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
December 15, 2013, 01:28:33 AM
 #10

Specify the path to php.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
BlockChainLottery
Sr. Member
****
Offline Offline

Activity: 332
Merit: 250


AwesomeDice.net


View Profile WWW
December 17, 2013, 01:41:51 PM
 #11

When using shell script, does the log file has write protection?
If for example, two notifications being issued, can the text become scrambled if the two scripts trying to write at the same time?

kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
December 17, 2013, 01:50:52 PM
 #12

If that is a concern for you, use something that you know can handle concurrent writes, like a database.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
jlp
Sr. Member
****
Offline Offline

Activity: 266
Merit: 264


View Profile
January 30, 2014, 05:14:51 PM
Last edit: January 30, 2014, 07:04:33 PM by jlp
 #13

Hi,

I am trying to use the -walletnotify option to run a php script which updates a log file/sql db with transaction id of new transaction affecting wallet.

For some reason I cannot get it working. I am using bitcoin version 80100.

I have tried this in my bitcoin.conf:

walletnotify=php /home/blahblah/Downloads/btcdev/walletnotify.php %s

and..

walletnotify="php /home/blahblah/Downloads/btcdev/walletnotify.php %s"


and also run bitcoind with and without the walletnotify commandline options: bitcoind -datadir=/home/blahblah/Downloads/testnet -testnet -debug -printtoconsole -walletnotify=php /home/blahblah/Downloads/btcdev/walletnotify.php %s

I can see the new transactions coming in but neither bitcoin-qt or bitcoind seem to try to run my script or error.

Any suggestions? Grin

Inca

I can get walletnotify to run a shell script.  Similar to user Inca, I cannot get walletnofiy to run a PHP program.

I am using Bitcoin-QT version 0.8.6 in testnet mode on a Mac OSX.  I have tried this in my bitcoin.conf:

walletnotify=php /Users/JLP/git_source/src/bin/walletnotify.php %s

and..

walletnotify="php /Users/JLP/git_source/src/bin/walletnotify.php %s"

I ran this in my terminal:

chmod a+x /Users/JLP/git_source/src/bin/walletnotify.php

but still to no avail.  Can someone help?

Update:  I found out how to invoke the php program.  I used curl:

walletnotify=curl http://localhost:8888/walletnotify.php/?transactionhash=%s

Is this transaction hash equal to the transaction id as required by the gettransaction command from https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list?
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 30, 2014, 06:59:42 PM
 #14

Specify the path to php.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
jlp
Sr. Member
****
Offline Offline

Activity: 266
Merit: 264


View Profile
January 30, 2014, 07:08:09 PM
 #15

Specify the path to php.

I'm not sure if your posting is in reply to my question about invoking my PHP program.  If so, I'm not sure what you mean.  I had specified the path to the php file.  It is /Users/JLP/git_source/src/bin/walletnotify.php in the following string:

walletnotify=php /Users/JLP/git_source/src/bin/walletnotify.php %s

If I can get this to work, isn't this the preferred method than to use curl, which seems like a roundabout way?
secbc
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
January 30, 2014, 08:41:01 PM
 #16

KJJ is saying the path to the PHP executable NOT the script, you have that.

Depending on your system it will most likely be something like

/usr/bin/php /Users/JLP/git_source/src/bin/walletnotify.php %s

if your on a linux-ish system (Mac, linux) you can run `whereis php` and that should tell you
jlp
Sr. Member
****
Offline Offline

Activity: 266
Merit: 264


View Profile
January 31, 2014, 04:02:20 AM
 #17

KJJ is saying the path to the PHP executable NOT the script, you have that.

Depending on your system it will most likely be something like

/usr/bin/php /Users/JLP/git_source/src/bin/walletnotify.php %s

if your on a linux-ish system (Mac, linux) you can run `whereis php` and that should tell you

Thanks for clarifying it.

I ran `whereis php` and terminal replied with:

/usr/bin/php

I changed bitcoin.conf so that it has the following:

walletnotify=/usr/bin/php /Users/JLP/git_source/src/bin/walletnotify.php/?trxhash=%s

...but it still does not work.  I changed it to the following:

walletnotify="/usr/bin/php /Users/JLP/git_source/src/bin/walletnotify.php/?trxhash=%s"

...but it still does not work.  Does anyone have any suggestions on how to get this to work?
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 31, 2014, 01:19:16 PM
 #18

Is ? a valid means of passing arguments to PHP on the command line?  I've never tried it.  I always use argc/argv, but my quick google search suggests that you can also use CGI style arguments:

/path/to/php /path/to/script.php trxhash=%s

and trxhash will be populated in $_GET, etc.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
jlp
Sr. Member
****
Offline Offline

Activity: 266
Merit: 264


View Profile
January 31, 2014, 03:34:27 PM
 #19

Is ? a valid means of passing arguments to PHP on the command line?  I've never tried it.  I always use argc/argv, but my quick google search suggests that you can also use CGI style arguments:

/path/to/php /path/to/script.php trxhash=%s

and trxhash will be populated in $_GET, etc.

The following works with ? as a means of passing arguments to PHP:

walletnotify=curl http://localhost:8888/script.php/?trxhash=%s

How do I use argc/argv?

I tried the following by entering it in my Mac terminal and it works:

/usr/bin/php /path/to/script.php

I tried the following by entering them in my Mac terminal, but they do not work:

/usr/bin/php /path/to/script.php/?wallethash=testing

The above returns this error:

Could not open input file: /usr/bin/php /path/to/script.php/?wallethash=testing

/usr/bin/php /path/to/script.php?wallethash=testing

The above returns this error:

Could not open input file: /usr/bin/php /path/to/script.php?wallethash=testing

I put in the following into my PHP program:

print_r($_GET['blockhash']);
print_r($_SERVER['QUERY_STRING']);


I tried the following in my Mac terminal:

/usr/bin/php /path/to/script.php wallethash=testing

The above returns this error:

PHP Notice:  Undefined index:  wallethash in /path/to/script.php on line 17
PHP Notice:  Undefined index:  QUERY_STRING in /path/to/script.php on line 18

I welcome any other suggestions.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 31, 2014, 06:08:41 PM
Merited by ABCbits (3)
 #20

I'm not on a mac, but try these anyway.

This is a minimal, but functional, PHP script that can be called from walletnotify:

Code: (walletnotify.php)
!/bin/php
<?php

if(2==$argc){
 
$fp=fopen("/tmp/notify_wallet","a");
 
$out=date("Ymd His")." - ".$argv[1]."\n";
 
fwrite($fp,$out);
}
?>


And two tested and working walletnotify lines:

Code:
walletnotify=/usr/local/bin/walletnotify.php %s
Code:
walletnotify=/bin/php /usr/local/bin/walletnotify.php %s

Note that there are no quotes in either line.

For the first option, the php file must be executable, and the path to your php binary must be set in the first line.  In the second option, you need to set your php path correctly in the walletnotify line.

Try these two first.  If you can get one of them working, you have a working baseline for making your own changes.  If you can't get it working, let me know and we'll figure it out.

Is ? a valid means of passing arguments to PHP on the command line?  I've never tried it.  I always use argc/argv, but my quick google search suggests that you can also use CGI style arguments:

/path/to/php /path/to/script.php trxhash=%s

and trxhash will be populated in $_GET, etc.

The following works with ? as a means of passing arguments to PHP:

walletnotify=curl http://localhost:8888/script.php/?trxhash=%s

curl is talking to your webserver, so HTTP syntax rules applies there (but not here, unless you want to run it that way).

How do I use argc/argv?

See above.  Basically, argc is the number of arguments on the command line, including the name of the script.  argv is an array of the command line elements, starting with argv[0] set to the name of the script.

I tried the following by entering it in my Mac terminal and it works:

/usr/bin/php /path/to/script.php

I tried the following by entering them in my Mac terminal, but they do not work:

/usr/bin/php /path/to/script.php/?wallethash=testing

You have no file named "/path/to/script.php/?wallethash=testing" on your system.  ?, = and even / are perfectly valid characters to have in a filename.  (really!)

The above returns this error:

Could not open input file: /usr/bin/php /path/to/script.php/?wallethash=testing

/usr/bin/php /path/to/script.php?wallethash=testing

The above returns this error:

Could not open input file: /usr/bin/php /path/to/script.php?wallethash=testing

Ditto.

I put in the following into my PHP program:

print_r($_GET['blockhash']);
print_r($_SERVER['QUERY_STRING']);


I tried the following in my Mac terminal:

/usr/bin/php /path/to/script.php wallethash=testing

The above returns this error:

PHP Notice:  Undefined index:  wallethash in /path/to/script.php on line 17
PHP Notice:  Undefined index:  QUERY_STRING in /path/to/script.php on line 18

I welcome any other suggestions.

Double check your names.  You seem to be switching between wallethash and blockhash.  Also, try print_r($_GET);

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Pages: [1] 2 3 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!