We recently migrated to SSL, and the site works great with the exception of one function. The function uses curl in the code below to execute an api located on the same server.
Following a 301 redirect can cause a POST request to be followed up with a GET request.
Change the URL you are requesting to the URL you actually want (i.e. not the old one that now returns a redirect instruction).