The second message is about curl, as I suspected, it's not working. Could I add to a precompiled installation of php?
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo /etc/init.d/apache2 restart
Now the code work fine when uploading from url. I cannot still upload from file, but think I'll fix soon. Thank you a lot for your help!