Update download.php

Trim clumsy code & change download method from fgets to curl