I know this post is a couple of year old, but it answered a question for me as I am getting more up to speed with Curl. I thought I'd share this in case someone else came here:
Looking at the current man page, it looks like the '-X POST' option is redundant in that the '--data' option make the request a POST (see both '--data' and '-X' in man page for details.) So that said, the above could also be sent as:
curl --data @data.txt http://localhost/app/test.php
Small thing, but just thought I'd share what I figured out since I found your post helpful.