private function check_for_authentication() { /* if auth_required is not set, assume false */ if (!isset($this->api_call()->attributes()->auth_required)) { return; } if ($this->api_call()->attributes()->auth_required == 'true' && TwitPic::mode() == TwitPic_Config::MODE_READONLY) { throw new TwitPicAPIException("API call {$this->category}/{$this->method} requires an API key and OAuth credentials"); } }
*/ $api_key = ""; // your TwitPic API key (http://dev.twitpic.com/apps) $consumer_key = ""; // your Twitter application consumer key $consumer_secret = ""; // your Twitter application consumer secret $oauth_token = ""; // the user's OAuth token (retrieved after they log into Twitter and auth there) $oauth_secret = ""; // the user's OAuth secret (also from Twitter login) /* * The TwitPic() constructor can be left blank if only * doing non-auth'd API calls */ $twitpic = new TwitPic($api_key, $consumer_key, $consumer_secret, $oauth_token, $oauth_secret); try { /* * Retrieves all images where the user is facetagged */ $user = $twitpic->faces->show(array('user' => 'meltingice')); print_r($user->images); $media = $twitpic->media->show(array('id' => 1234)); echo $media->message; $user = $twitpic->users->show(array('username' => 'meltingice'), array('process' => false, 'format' => 'xml')); echo $user; // raw XML response data /* * Uploads an image to TwitPic */ $resp = $twitpic->upload(array('media' => 'path/to/file.jpg', 'message' => 'This is an example'));