need to check $proxy for != null here? I'm not sure how PHP will handle this if it is null.