basil Welcome to Flarum !
I think you're supposed to do a POST request.
When typing the url in the browser you're doing a GET and it seems your curl script also does not specify a method, so I guess it defaults to something else as well (unless setting a post fields automatically switches to POST ?)
Not sure how a POST is done with curl though, I always use "higher-level" libraries like Guzzle which makes reading the code a lot easier ?
I hope this helps !