コード例 #1
0
 /**
  * GooglePlus constructor.
  *
  * @param string  $strProfile The url/id of the Google+ profile.
  * @param integer $intCache   The maximum age (in minutes) of the cache (default 4 hours).
  */
 public function __construct($strProfile, $intCache = 240)
 {
     // This script requires cURL.
     if (!function_exists('curl_init')) {
         throw new GooglePlusException('cURL not installed. See http://php.net/manual/en/book.curl.php for details.');
     }
     // Check if debug should be enabled or not.
     if (GooglePlus::GPLUS_DEBUG) {
         error_reporting(-1);
         ini_set('display_errors', 1);
     } else {
         error_reporting(0);
         ini_set('display_errors', 0);
     }
     // Set the global cache timeout (fallback to 4 hours if the value is crap).
     $this->_intCache = is_int($intCache) ? $intCache : 240;
     // Fetch the HTML of the page.
     if (!GooglePlus::fetchUrl($strProfile)) {
         //throw new GooglePlusException('Error fetching the HTML of this Google+ profile.');
         echo 'Failed';
     }
 }