This week I’ve been working on a feature which handles an incoming API call from an external source (actually Paypal’s IPN service). Making external calls into my development platform isn’t how I usually work, so instead I captured the body of the request that was being sent, and replayed it against my local script using curl.
I put the data into a separate file,
data.txt and then used curl to direct that data at my local URL:
curl -X POST http://localhost/app/test.php --data @data.txt
I find this approach useful for testing, but since I had to look up how to do it, I thought I’d put it here for reference!