Repository navigation
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Β | Β | |||
Β | Β | |||
Β | Β | |||
Repository files navigation
<style>
dt { margin-top: 1em; }
</style>
<h1>PEAR::Flickr_API</h1>
<h2>INSTALLATION</h2>
<ul>
<li>Install <a href="http://pear.php.net/">PEAR</a>.</li>
<li>At the command prompt, type "<code>pear install -of http://code.iamcal.com/php/flickr/Flickr_API-Latest.tgz</code>".</li>
<li>If you don't have command line access, then just <a href="http://code.iamcal.com/php/flickr/simple-package-latest.zip">unzip this package</a> into a folder in your include_path.</li>
</ul>
<h2>USAGE</h2>
<pre>
require_once 'Flickr/API.php';
# create a new api object
$api =& new Flickr_API(array(
'api_key' => '1234567890',
));
# call a method
$response = $api->callMethod('flickr.test.echo', array(
'foo' => 'bar',
));
# check the response
if ($response){
# response is an XML_Tree root object
}else{
# fetch the error
$code = $api->getErrorCode();
$message = $api->getErrorMessage();
}
</pre>
<h2>METHODS</h2>
<dl>
<dt><code>void Flickr_API(array $params)</code></dt>
<dd>The constructor takes an optional array of parameters as follows:
<dl>
<dt><code>api_key</code></dt>
<dd>Your Flickr API key</dd>
<dt><code>api_secret</code></dt>
<dd>The auth secret tied to your API key (only needed for authenticated calls)</dd>
<dt><code>endpoint</code></dt>
<dd>The Flickr REST endpoint (a sensible default is used when you don't specify one)</dd>
<dt><code>auth_endpoint</code></dt>
<dd>The Flickr Auth endpoint (a sensible default is used when you don't specify one)</dd>
<dt><code>conn_timeout</code></dt>
<dd>HTTP connection timeout in seconds (defaults to 5)</dd>
<dt><code>io_timeout</code></dt>
<dd>HTTP IO timeout in seconds (defaults to 5)</dd>
</dl>
</dd>
<dt><code>XML_Tree callMethod(string $method, array $params)</code></dt>
<dd>Calls the method <code>$method</code> with an optional array of parameters.</dd>
<dt><code>integer getErrorCode()</code></dt>
<dd>Returns the error code for the last method call.</dd>
<dt><code>string getErrorMessage()</code></dt>
<dd>Returns the error message for the last method call.</dd>
<dt><code>string getAuthUrl(string $perms, string $frob='')</code></dt>
<dd>Returns a signed url to direct an authenticating user to. A frob only needs to be passed for non-web applications.</dd>
</dl>