コード例 #1
0
ファイル: Podio.php プロジェクト: 2UP/podio-doc-to-pdf
 public static function setup($client_id, $client_secret, $options = array('session_manager' => null, 'curl_options' => array()))
 {
     // Setup client info
     self::$client_id = $client_id;
     self::$client_secret = $client_secret;
     // Setup curl
     self::$url = empty($options['api_url']) ? 'https://api.podio.com:443' : $options['api_url'];
     self::$debug = self::$debug ? self::$debug : false;
     self::$ch = curl_init();
     self::$headers = array('Accept' => 'application/json');
     curl_setopt(self::$ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt(self::$ch, CURLOPT_SSL_VERIFYPEER, 1);
     curl_setopt(self::$ch, CURLOPT_SSL_VERIFYHOST, 2);
     curl_setopt(self::$ch, CURLOPT_USERAGENT, 'Podio PHP Client/' . self::VERSION);
     curl_setopt(self::$ch, CURLOPT_HEADER, true);
     curl_setopt(self::$ch, CURLINFO_HEADER_OUT, true);
     //Update CA root certificates - require: https://github.com/Kdyby/CurlCaBundle
     if (class_exists('\\Kdyby\\CurlCaBundle\\CertificateHelper')) {
         \Kdyby\CurlCaBundle\CertificateHelper::setCurlCaInfo(self::$ch);
     }
     if ($options && !empty($options['curl_options'])) {
         curl_setopt_array(self::$ch, $options['curl_options']);
     }
     self::$session_manager = null;
     if ($options && !empty($options['session_manager']) && class_exists($options['session_manager'])) {
         self::$session_manager = new $options['session_manager']();
         self::$oauth = self::$session_manager->get();
     }
     // Register shutdown function for debugging and session management
     register_shutdown_function('Podio::shutdown');
 }
コード例 #2
0
 public static function setup($client_id, $client_secret, $options = array('session_manager' => 'PodioSession', 'curl_options' => array()))
 {
     // Setup client info
     self::$client_id = $client_id;
     self::$client_secret = $client_secret;
     // Setup curl
     self::$url = empty($options['api_url']) ? 'https://api.podio.com:443' : $options['api_url'];
     self::$debug = self::$debug ? self::$debug : false;
     self::$ch = curl_init();
     self::$headers = array('Accept' => 'application/json');
     curl_setopt(self::$ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt(self::$ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt(self::$ch, CURLOPT_SSL_VERIFYHOST, false);
     curl_setopt(self::$ch, CURLOPT_USERAGENT, 'Podio PHP Client/3.0');
     curl_setopt(self::$ch, CURLOPT_HEADER, true);
     curl_setopt(self::$ch, CURLINFO_HEADER_OUT, true);
     if ($options && !empty($options['curl_options'])) {
         curl_setopt_array(self::$ch, $options['curl_options']);
     }
     self::$session_manager = null;
     if ($options && !empty($options['session_manager']) && class_exists($options['session_manager'])) {
         self::$session_manager = new $options['session_manager']();
         self::$oauth = self::$session_manager->get();
     }
     // Register shutdown function for debugging and session management
     register_shutdown_function('Podio::shutdown');
 }