Forked from www.phpclasses.org/package/7700-PHP-Authorize-and-access-APIs-using-OAuth.html