Please change lines 212 and 213 in /lib/socialnetworkslib.php to the following:
$msg = tr('Error attempting to connect to graph.facebook.com:') . ' ' . $errstr . ' '
. tr('(error number %0)', $errno) . tr(' with url - %0', $url);
It should show the url being used to try to connect to graph.facebook.com. My thinking is that you could test that url on the Graph Explorer on Facebook or art least see if all the parts are there: redirect_uri, client_id, client_secret, code. If it passes the test there, then there is another method of connecting we can try.
I am going to work now so won't be able to respond until this evening.