make lib more re-usable by moving api key and app id to top level
arguments. Added private/public visibility so this is no longer php4
compatible but should be php5.0+