I found this on a rather obscure forum:
The apache user is disallowed to make http connections by default. To enable this, do the following from root:
setsebool -P httpd_can_network_connect 1
that was found on http://forums.phpfreaks.com/topic/64806-solved-could-not-connect-to-server-permission-denied/