Added -L flag to curl command to allow following of redirects. Thanks to user @yagmot for pointing out this fix