Ejemplo n.º 1
0
// 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'));
    print_r($resp);
    /*
     * Uploads an image to TwitPic AND posts a tweet
     * to Twitter
     */
    $resp = $twitpic->uploadAndPost(array('media' => 'path/to/file.jpg', 'message' => 'Another example'));
    print_r($resp);
} catch (TwitPicAPIException $e) {
    echo $e->getMessage();
}