Implemented php-level redirect logic for file_get_contents in order to determine final location