1 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
3 <title>CarbonPHP Documentation
</title>
4 <style type=
"text/css">
11 font-family: "Lucida Sans Unicode", "Lucida Grande";
33 margin: 10px 0 10px 0;
34 list-style-position: inside
;
42 border: 1px dotted
#444;
50 border: 1px solid
#ccc;
60 <h1>Flickr API Library
</h1>
62 <p>The Flickr API library allows you to easily use the Flickr API. You initialise the library using the
63 following line and the object will be available as
<b>$this-
>flickr
</b>.
</p>
66 $this-
>load-
>library('flickr');
69 <p>You can also pass configuration parameters as an array in the second parameter of the method.
</p>
72 $this-
>load-
>library('flickr', array('api_key' =
> 'yourapikeyhere', 'api_secret' =
> 'yourapisecrethere'));
77 <h1>Calling a Flickr API Method
</h1>
79 <p>You can use the
<b>$this-
>flickr-
>call_method()
</b> method to call a Flickr API method.
</p>
82 $this-
>flickr-
>call_method('flickr.test.echo', array('foo' =
> 'bar', 'carbon' =
> 'php'));
85 <p>The above code will call the
<b>flickr.test.echo
</b> method and will return an XML response. If the call fails
86 the
<b>$this-
>flickr-
>call_method()
</b> will return -
1, and you can call the following two methods to get the error code
90 echo $this-
>flickr-
>get_error_code();
<br />
91 echo $this-
>flickr-
>get_error_message();
</br />
94 <p>If the method call is successful you will get an XML representation in an object (simple XML). You can then parse this
95 reponse. The reponse to our above method call will look something like the following response.
</p>
98 <rsp
stat=
"ok"><br />
99 <method
>flickr.test.echo
</method
><br />
100 <api_key
>apikeywillbehere
</api_key
><br />
101 <foo
>bar
</foo
><br />
102 <carbon
>php
</carbon
><br />
107 <div class=
"content">
108 <h1>Calling Methods that Require Authentication
</h1>
110 <p>Some methods require that the user be authenticated to Flickr. When you register your web application you
111 can specify a callback URL that Flickr will redirect the user to once they are authenticated. To create the URL the
112 user must visit to authenticate the use of your web application is shown in the following code.
</p>
114 <div class=
"example">
115 echo $this-
>flickr-
>get_auth_url('read');
118 <p>This will create an authentication URL that will grant your web application read permissions to the users
121 <p>There are three permissions you can set they are shown below.
</p>
124 <li>read - grants the permission to read private information
</li>
125 <li>write - grants the permission to add, edit, delete photo metadata, this includes 'read'
</li>
126 <li>delete - grants the permission to delete photos, this includes 'write' and 'read'
</li>
129 <p>Once authenticated you can store the frob token, and use this to get a token to call the authenticated