Definitely it was a proxy problem,
Here I found a fix: http://robertmarkbramprogrammer.blogspot.com.es/2012/03/using-proxy-with-authentication-in-php.html
It works but I’m trying to get the proxy host and port variables from the config.inc.php, as now I have hardcoded them.