Yes.
Create a nodejs file that subscribes to the websocket feed.
Then check each new entry to see if it matches what you're looking for. If it does then initiate the request module to hit your PHP page.
npm install both the
websocket and
request modules.
npm install ws --save
npm install request --save
var WebSocket = require("ws");
var request = require("request");
var btcs = new WebSocket('wss://ws.blockchain.info/inv');
btcs.onopen = function()
{
btcs.send( JSON.stringify( {"op":"unconfirmed_sub"} ) );
};
btcs.onmessage = function(onmsg)
{
var response = JSON.parse(onmsg.data);
var outAddr = response.x.out[0].addr;
if(outAddr == "1BitcoinEaterAddressDontSendf59kuE")
{
request({
url: "https://somesite.com/page.php",
json: true
}, function(err, res, body){
if(err){
console.log(err);
}
console.log(res);
console.log("PHP page ran");
});
}
}
The above way is checks ALL transactions, so it's kinda wasteful.
It would be better to subscribe to an address instead of all transactions.
var WebSocket = require("ws");
var request = require("request");
var btcs = new WebSocket('wss://ws.blockchain.info/inv');
var address = "1BitcoinEaterAddressDontSendf59kuE";
var btcs = new WebSocket("wss://ws.blockchain.info/inv");
btcs.onopen = function(){
btcs.send(JSON.stringify({“op”:”addr_sub”, “addr”:address}));
};
btcs.onmessage = function(onmsg)
{
var response = JSON.parse(onmsg.data);
var getOuts = response.x.out;
var countOuts = getOuts.length;
for(i = 0; i < countOuts; i++)
{
//check every output to see if it matches specified address
var outAdd = response.x.out[i].addr;
var specAdd = address;
if (outAdd == specAdd)
{
var amount = response.x.out[i].value;
//transaction received
//include a parameter with the amount in satoshis if you want
request({
url: "https://somesite.com/page.php?value="+amount,
json: true
}, function(err, res, body){
if(err){
console.log(err);
}
console.log(res);
console.log("PHP page ran");
});
};
};
}