Phirehose::__construct PHP Method

__construct() public method

Methods are: METHOD_FIREHOSE, METHOD_RETWEET, METHOD_SAMPLE, METHOD_FILTER, METHOD_LINKS, METHOD_USER, METHOD_SITE. Note: the method might cause the use of a different endpoint URL. Formats are: FORMAT_JSON, FORMAT_XML
See also: Phirehose::METHOD_SAMPLE
See also: Phirehose::FORMAT_JSON
public __construct ( string $username, string $password, string $method = Phirehose::METHOD_SAMPLE, string $format = self::FORMAT_JSON, $lang = FALSE )
$username string Any twitter username. When using oAuth, this is the 'oauth_token'.
$password string Any twitter password. When using oAuth this is you oAuth secret.
$method string
$format string
    public function __construct($username, $password, $method = Phirehose::METHOD_SAMPLE, $format = self::FORMAT_JSON, $lang = FALSE)
    {
        $this->username = $username;
        $this->password = $password;
        $this->method = $method;
        $this->format = $format;
        $this->lang = $lang;
        switch ($method) {
            case self::METHOD_USER:
                $this->URL_BASE = 'https://userstream.twitter.com/1.1/';
                break;
            case self::METHOD_SITE:
                $this->URL_BASE = 'https://sitestream.twitter.com/1.1/';
                break;
            default:
                break;
                //Stick to the default
        }
    }

Usage Example

コード例 #1
0
ファイル: ghetto-queue-collect.php プロジェクト: dgw/ThinkUp
 /**
  * Overidden constructor to take class-specific parameters
  *
  * @param string $username
  * @param string $password
  * @param string $queueDir
  * @param integer $rotateInterval
  */
 public function __construct($username, $password, $queueDir = '/tmp', $rotateInterval = 10)
 {
     // Sanity check
     if ($rotateInterval < 5) {
         throw new Exception('Rotate interval set too low - Must be >= 5 seconds');
     }
     // Set subclass parameters
     $this->queueDir = $queueDir;
     $this->rotateInterval = $rotateInterval;
     // Call parent constructor
     return parent::__construct($username, $password, Phirehose::METHOD_FILTER);
 }
All Usage Examples Of Phirehose::__construct