Add follow location workaround

Handling redirections with curl if safe_mode or open_basedir is enabled.