<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ReloadedPC Ashland, Ohio &#187; petfinder api</title>
	<atom:link href="http://www.reloadedpc.com/tag/petfinder-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reloadedpc.com</link>
	<description>Small Business Website Development</description>
	<lastBuildDate>Tue, 24 Jan 2012 18:36:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>PetFinder API PHP Class Library</title>
		<link>http://www.reloadedpc.com/php/petfinder-api-php-class-library/</link>
		<comments>http://www.reloadedpc.com/php/petfinder-api-php-class-library/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 04:14:56 +0000</pubDate>
		<dc:creator>Joe</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[petfinder]]></category>
		<category><![CDATA[petfinder api]]></category>
		<category><![CDATA[php class]]></category>
		<category><![CDATA[php library]]></category>

		<guid isPermaLink="false">http://www.reloadedpc.com/?p=69</guid>
		<description><![CDATA[I was interested in a project for a website as to what data could be retrieved from PetFinder.com. To my surprise, on their website located in the footer is a link to their API documentation. In order to use their API, you must first fill out a developer request for a key &#38; password. I [...]]]></description>
			<content:encoded><![CDATA[<h3><span style="font-weight: normal; font-size: 13px;">I was interested in a project for a website as to what data could be retrieved from <a href="http://www.petfinder.com">PetFinder.com</a>. To my surprise, on their website located in the footer is a link to their <a href="http://www.petfinder.com/developers/api-docs#methods">API documentation</a>. In order to use their API, you must first fill out a developer request for a key &amp; password. I did a quick look to see if anyone had written a php class for accessing the api, but couldn&#8217;t find anything useful. I have created a php class that you can call the certain methods available to retrieve the records.</span></h3>
<h3>Update 6-30-2010:</h3>
<p>I recently updated the class to enable caching the xml response from the Petfinder server. This should provide a nice little speed boost even though it was already pretty fast <img src='http://www.reloadedpc.com/wp-includes/images/smilies/icon_smile.gif' alt="PetFinder API PHP Class Library icon smile " class='wp-smiley' title="PetFinder API PHP Class Library" /> . Caching is enabled by default, and caches expires in 3 minutes. The folder &#8220;cache_files&#8221; in zip folder must have write permissions. As shown in the instructions, you can change the paths of cache files.</p>
<p><span id="more-69"></span>This class will parse the returned xml as a data array. This libary requires just 4 easy steps to get data:</p>
<ol>
<li>Add api-password to class</li>
<li>Add api-key to class</li>
<li>Pass configuration values as an array</li>
<li>Call the method in the class</li>
</ol>
<p>Here is an example of how to use the php class</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'class.petfinder.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//include class</span>
<span style="color: #000088;">$pet</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Petfinder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//create Petfinder object</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setKey</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'12345'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//your api-key</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setPass</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'abcdef'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//your api-secret</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_expire'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">360</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//(optional) Time in secs to expire  default shown</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_path'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'full_path_to_cache_folder'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//(optional) Set cache path </span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cache_enable'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//(optional) Disable cache feature </span>
&nbsp;
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'location '</span><span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'44805'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'animal'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'dog'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//associative array of values to pass to class. array keys must match arguments from API</span>
<span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span> <span style="color: #666666; font-style: italic;">//pass values to the class</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">petFind</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//call API method which are accessed by camel casing them (pet.find=petFind)</span></pre></div></div>

<p>The xml data is returned as an associative array. The array has been mapped to the xml layout returned by PetFinder. Echo out the variable and you will see the returned status code, the array of returned values, and the xml response data from PetFinder.</p>
<p><a href="http://bitbucket.org/pickupman/petfinder">Download</a></p>
<p>If you would like to donate, you may do so by using Paypal.</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="10530731" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" type="image" />
<img src="https://www.paypal.com/en_US/i/scr/pixel.gif" border="0" alt="PetFinder API PHP Class Library pixel " width="1" height="1" title="PetFinder API PHP Class Library" /><br />
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.reloadedpc.com/php/petfinder-api-php-class-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 7/18 queries in 0.011 seconds using disk: basic
Object Caching 380/421 objects using disk: basic

Served from: www.reloadedpc.com @ 2012-02-05 04:30:12 -->
