There is a web3 library that is available in several programming languages. For instance, you may use oython implementation (web3.py). Here is a [link][1] where you may find more details.

this is an example:

 web3 = Web3(HTTPProvider('link to the node'))
 recent_block_number = web3.eth.blockNumber
 for i in range(recent_block_number - 3, recent_block_number +1):
 block = web3.eth.getBlock(block_hash, full_transactions=True)
 transactions = block['transactions']

But you will need a local node. For testing reason Ganache would be appropriate.
Hope this will help!
 


 [1]: https://web3py.readthedocs.io/en/stable/web3.eth.html#methods