Services_TwitPic
[ class tree: Services_TwitPic ] [ index: Services_TwitPic ] [ all elements ]

Class: Services_TwitPic

Source Location: /Services_TwitPic-0.1.0/Services/TwitPic.php

Class Overview


Services_TwitPic


Author(s):

Copyright:

  • 2008 Bill Shupp

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 52]
Services_TwitPic

PHP Interface for uploading pictures to TwitPic API, as well as posting the pictures with optional status messages to Twitter.

  1.  $user     'username';
  2.  $pass     'password';
  3.  $filename '/Users/bill/Desktop/images.jpg';
  4.  
  5.  $twit = new Services_TwitPic($user$pass);
  6.  try {
  7.      $twit->setOption('timeout'10);
  8.      $result $twit->uploadAndPost($filename'testing image upload');
  9.      print_r($result);
  10.  catch (Services_TwitPic_Exception $e{
  11.      print_r($e->getMessage());
  12.      print_r($e->getCode());
  13.  }



[ Top ]


Class Variables

$options = array(
        'timeout'   => 30,
        'userAgent' => 'Services_TwitPic 0.1.0'
    )

[line 99]

Options used by the requestor

Type:   array


[ Top ]

$password =  ''

[line 83]

Twitter password
  • Access: protected

Type:   string


[ Top ]

$requestor =

[line 91]

Instance of the requestor (HTTP_Request or Mock) for doing the HTTP transport. Mock is used for testing, using canned responses.
  • Access: protected

Type:   mixed


[ Top ]

$uri =  'http://twitpic.com/api'

[line 70]

URI of the TwitPic API server
  • Access: public

Type:   string


[ Top ]

$username =  ''

[line 77]

Twitter username
  • Access: protected

Type:   string


[ Top ]



Method Detail

__construct (Constructor)   [line 112]

Services_TwitPic __construct( string $username, string $password, [string $requestor = 'HTTPRequest'])

Sets the username and password for requests.
  • Access: public

Parameters:

string   $username   —  Twitter username
string   $password   —  Twitter password
string   $requestor   —  Which requestor driver to use, defaults to HTTPRequest

[ Top ]

getOption   [line 254]

mixed getOption( mixed $key)

Retrieves an option from $options.
  • Return: Option value on success, null on failure
  • Access: public

Parameters:

mixed   $key   —  Option to get

[ Top ]

getRequestor   [line 269]

TwitPic_Request_Common getRequestor( string $uri)

Instantiates the requestor.
  • Return: A TwitPic_Request_Common Object
  • Access: protected

Parameters:

string   $uri   —  Endpoint URI being queried.

[ Top ]

sendRequest   [line 157]

SimpleXMLElement sendRequest( string $endPoint, array $params)

Sends a request to the TwitPic API.
  • Return: A SimpleXMLElement Object
  • Throws: Services_TwitPic_Exception on error
  • Access: protected

Parameters:

string   $endPoint   —  The API endpoint
array   $params   —  The API endpoint arguments to pass

[ Top ]

setOption   [line 216]

bool setOption( mixed $option, mixed $value)

Sets an option.

Parameters:

mixed   $option   —  Option to set
mixed   $value   —  Option value to set

[ Top ]

setOptions   [line 240]

void setOptions( array $options)

Overrides default options.

Available options:

 timeout:   Timeout in seconds (default: 30)
 userAgent: User-Agent string to be used.
            (default: 'ServicesTwitPic 0.1.0')


Parameters:

array   $options   —  $options to set

[ Top ]

upload   [line 126]

mixed upload( mixed $file)

Uploads an image to TwitPic.

Parameters:

mixed   $file   —  Image file name to upload

[ Top ]

uploadAndPost   [line 139]

mixed uploadAndPost( mixed $file, [mixed $message = null])

Uploads an image and optional message to TwitPic and posts to Twitter.

Parameters:

mixed   $file   —  Image file name to upload
mixed   $message   —  Optional message to include in the tweet

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:25:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.