Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #6 from caseysoftware/master

+1
  • Loading branch information...
commit e63af32c898cd6b76f99ad92cd0da6189ff4c1ab 2 parents 18131d3 + 682982b
@colinpilloud colinpilloud authored
View
2  README.md
@@ -5,7 +5,7 @@ This is a PHP helper for the FullContact API - http://www.fullcontact.com/
It is modeled after the Twilio PHP Helper library because I think it's generally well done and thought through. This isn't official but should generally work except for the incomplete items in the TODO list below.
-This is **v0.2** so it is super rudimentary and subject to change at any time.. like now. Or maybe now.
+This is v0.9.0 so it is pretty stable and I don't expect the interfaces to change much if at all.
## Requirements
View
55 Services/FullContact.php
@@ -36,7 +36,7 @@ function Services_FullContact_autoload($className) {
*/
class Services_FullContact
{
- const USER_AGENT = 'caseysoftware/fullcontact-php-0.2';
+ const USER_AGENT = 'caseysoftware/fullcontact-php-0.9.0';
protected $_baseUri = 'https://api.fullcontact.com/';
protected $_version = 'v2';
@@ -95,57 +95,4 @@ protected function _execute($params = array())
return $this->response_obj;
}
-}
-
-class FullContactAPI extends Services_FullContact_Person
-{
- public function __construct($api_key)
- {
- parent::__construct($api_key);
- trigger_error("The FullContactAPI class has been deprecated. Please use Services_FullContact instead.", E_USER_NOTICE);
- }
-
- /**
- * Instead of using this implementation, you should create a
- * Services_FullContact_Person class and use the lookup method you prefer.
- *
- * @deprecated
- *
- * @param String - Search Term (Could be an email address or a phone number,
- * depending on the specified search type)
- * @param String - Search Type (Specify the API search method to use.
- * E.g. email -- tested with email and phone)
- * @param String (optional) - timeout
- *
- * @return Array - All information associated with this email address
- */
- public function doLookup($search = null, $type="email", $timeout = 30)
- {
- if (is_null($search)) {
- throw new Services_FullContact_Exception_Base("To search, you must supply a search term.");
- }
-
- switch($type)
- {
- case 'email':
- $this->lookupByEmail($search);
- break;
- case 'phone':
- $this->lookupByPhone($search);
- break;
- case 'twitter':
- $this->lookupByTwitter($search);
- break;
- case 'facebookUsername':
- $this->lookupByFacebook($search);
- default:
- throw new FullContactAPIException("UnsupportedLookupMethodException: Invalid lookup method specified [{$type}]");
- break;
- }
-
- $result = json_decode($this->response_json, true);
- $result['is_error'] = !in_array($this->response_code, array(200, 201, 204));
-
- return $result;
- }
}
View
54 Services/FullContact/API.php
@@ -0,0 +1,54 @@
+<?php
+
+class Services_FullContact_API extends Services_FullContact_Person
+{
+ public function __construct($api_key)
+ {
+ parent::__construct($api_key);
+ trigger_error("The FullContactAPI class has been deprecated. Please use Services_FullContact instead.", E_USER_NOTICE);
+ }
+
+ /**
+ * Instead of using this implementation, you should create a
+ * Services_FullContact_Person class and use the lookup method you prefer.
+ *
+ * @deprecated
+ *
+ * @param String - Search Term (Could be an email address or a phone number,
+ * depending on the specified search type)
+ * @param String - Search Type (Specify the API search method to use.
+ * E.g. email -- tested with email and phone)
+ * @param String (optional) - timeout
+ *
+ * @return Array - All information associated with this email address
+ */
+ public function doLookup($search = null, $type="email", $timeout = 30)
+ {
+ if (is_null($search)) {
+ throw new Services_FullContact_Exception_Base("To search, you must supply a search term.");
+ }
+
+ switch($type)
+ {
+ case 'email':
+ $this->lookupByEmail($search);
+ break;
+ case 'phone':
+ $this->lookupByPhone($search);
+ break;
+ case 'twitter':
+ $this->lookupByTwitter($search);
+ break;
+ case 'facebookUsername':
+ $this->lookupByFacebook($search);
+ default:
+ throw new FullContactAPIException("UnsupportedLookupMethodException: Invalid lookup method specified [{$type}]");
+ break;
+ }
+
+ $result = json_decode($this->response_json, true);
+ $result['is_error'] = !in_array($this->response_code, array(200, 201, 204));
+
+ return $result;
+ }
+}
View
2  example/index.php
@@ -5,7 +5,7 @@
//initialize our FullContact API object
//get your api key here: http://fullcontact.com/getkey
-$fullcontact = new FullContactAPI($apikey);
+$fullcontact = new Services_FullContact_API($apikey);
//do a lookup
$result = $fullcontact->doLookup('bart@fullcontact.com');
Please sign in to comment.
Something went wrong with that request. Please try again.