Class libVerify

Description

class libVerify

Here are two brief examples on how to use this class.

To use this class and make it persistant use the following example:

  1. /**
  2. * Sample instantiation of this class
  3. *
  4. * This example stores the class in a SESSION variable which will allow you
  5. * to perform multiple lookups/verifications without resubmitting all of the data to this class.
  6. *
  7. * file: testid.php
  8. */
  9. require_once("libVerify.php");
  10. session_start();
  11. $vId = libVerify::getClass();
  12. $vId::setData("sid","SIDASSIGNEDFROMVERIFYME");
  13. $vId::setData("first","FirstName");
  14. $vId::setData("initial","M");
  15. $vId::setData("last","LastName");
  16. $vId::setData("gender","M");
  17. $vId::setData("address","Address");
  18. $vId::setData("state","OH");
  19. $vId::setData("country","US");
  20. $vId::setData("zip","43123");
  21. $vId::setData("dob","10/01/1960");
  22.  
  23. if ( $vId::isVerified() == true ) {
  24. echo "<h1>You have been verified</h1>\n";
  25. echo "transaction id is: " . $vId::getTransactionID() . "<br>\n";
  26. echo "match code is: " . $vId::getMatchCode() . "<br>\n";
  27. echo "matched with: " . $vId::getMatchCodeText() . "<br>\n";
  28. echo "return code: " . $vId::getErrorCode() . " (" . $vId::getErrorCodeText() . ")<br>\n";
  29. echo "<a href=\"testid.php?op=getDataXML\">Get the Data in XML</a>\n";
  30. echo "<br>\n";
  31. echo "<a href=\"testid.php?op=getResultXML\">Get the Result in XML</a>\n";
  32. echo "<br>\n";
  33. echo "<a href=\"testid.php?op=getRawResult\">Get the Raw Result</a>\n";
  34. } else {
  35. echo "<h1>Verification unsuccessful</h1>\n";
  36. echo "error code: " . $vId::getErrorCode() . " (" . $vId::getErrorCodeText() . ")<br>\n";
  37. echo "<a href=\"testid.php?op=getDataXML\">Get the Data in XML</a>\n";
  38. echo "<br>\n";
  39. echo "<a href=\"testid.php?op=getResultXML\">Get the Result in XML</a>\n";
  40. echo "<br>\n";
  41. echo "<a href=\"testid.php?op=getRawResult\">Get the Raw Result</a>\n";
  42. }

Using this class as standalone (no data will transfer between pages):

  1. /**
  2. * Sample instantiation of this class as standalone
  3. *
  4. * This example is only for a simple one time verification. It does not allow for
  5. * multiple submissions/verifications, so you'd have to instantiate this class and
  6. * set the data for every submission.
  7. *
  8. */
  9. require_once("libVerify.php");
  10. $vId = new libVerify();
  11. $vId::setData("sid","SIDASSIGNEDFROMVERIFYME");
  12. $vId::setData("first","FirstName");
  13. $vId::setData("initial","M");
  14. $vId::setData("last","LastName");
  15. $vId::setData("gender","M");
  16. $vId::setData("address","Address");
  17. $vId::setData("state","OH");
  18. $vId::setData("country","US");
  19. $vId::setData("zip","43123");
  20. $vId::setData("dob","10/01/1960");
  21.  
  22. if ( $vId::isVerified() == true ) {
  23. echo "<h1>You have been verified</h1>\n";
  24. echo "transaction id is: " . $vId::getTransactionID() . "<br>\n";
  25. echo "match code is: " . $vId::getMatchCode() . "<br>\n";
  26. echo "matched with: " . $vId::getMatchCodeText() . "<br>\n";
  27. echo "return code: " . $vId::getErrorCode() . " (" . $vId::getErrorCodeText() . ")<br>\n";
  28. } else {
  29. echo "<h1>Verification unsuccessful</h1>\n";
  30. echo "error code: " . $vId::getErrorCode() . " (" . $vId::getErrorCodeText() . ")<br>\n";
  31. }

Located in /libVerify.php (line 138)


	
			
Variable Summary
array $countries
array $error_codes
array $id_types
pointer $instance
array $match_codes
string $rawresult
array $result
array $submitdata
array $us_states
Method Summary
null libVerify ()
class getClass ()
string getCountriesHtml ()
array getCountryIdTypesArray (string $string)
string getCountryIdTypesDropDown (string $string)
string getCountryIdTypesHtml (string $string)
string getCountryName (string $string)
string getData (string $code)
array getDataArray ()
string getDataXML ()
string getErrorCode ()
string getErrorCodesXML ()
string getErrorCodeText ()
string getMatchCode ()
string getMatchCodesXML ()
string getMatchCodeText ()
string getRawResult ()
string getResultXML ()
string getTransactionId ()
array getUsStatesArray ()
string getUsStatesHtml ()
boolean isVerified ()
string makeRequest ()
class newClass ()
array parseResult (string $string)
boolean setCountry (string $string)
boolean setData (string $code, string $value)
boolean setDataFromArray (array $array)
boolean setIrelandCounty (string $string)
boolean setUsState (string $string)
boolean submitRequest ()
Variables
array $countries (line 228)

Array of all the supported countries.

kidsherriff.com supports varies countries. This array contains all of the supported countries. This array contains the country code (as the key) and the text (as the value).

All countries support the passport as the id_type, however, if the country supports other types of id, then the value will be an array in the form of:

array ( 0 => "country_name", 1 => "##", 2 => "##", ... )

For all supported id_types.

  • access: public
array $error_codes (line 180)

Array of all the possible error codes returned by the id query.

kidsherriff.com returns an error code with every verification request. This array contains the error code (as the key) and the text (as the value).

  • access: public
array $id_types (line 209)

Array of all the types of Identification supported.

kidsherriff.com requires an id_type as well as the id number. This is an array that contains all of the supported id types (as the key) and the text of that type (as the value).

NOTE: ALL COUNTRIES SUPPORT ( 0 => PASSPORT ), THEREFORE IT IS NOT IN THIS LIST.

  • access: public
pointer $instance (line 169)

Pointer to the current instance of this class.

  • access: protected
  • static:
array $ireland_counties (line 241)

Array of all the counties in Ireland.

Ireland is an exception for required information. In addition to the country, Ireland requires the country of residence to be set. This array contains all of the supported counties. This array contains the county code (as the key) and the county name (as the value).

  • access: public
array $match_codes (line 193)

Array of all the possible match codes returned by the id query.

kidsherriff.com returns a match code with every id request. This match code enables the verifier to check what level and method the person was verified with. This array contains the match code (as the key) and the text (as the value).

  • access: public
string $rawresult (line 161)
  • access: protected
  • static:
array $result (line 154)

Contains the parsed result from a query.

  • access: protected
  • static:
array $submitdata (line 146)

Contains the parsed data to be submitted

  • access: protected
  • static:
array $us_states (line 254)

Array of all the states in the United States.

The USA is an exception for required information. In addition to the country, kidsherrif requires the state of residence to be set. This array contains all of the supported states. This array contains the state code (as the key) and the state name (as the value).

  • access: public
Methods
Constructor libVerify (line 263)

This is a default constructor work around for PHP5, we don't want to recreate this class.

null libVerify ()
getClass (line 282)

Construct a new class or load an existing instance if one exists.

Returns the class instance itself.

class getClass ()
getCountriesArray (line 315)

Gets the countries as an array (without the id_types)

array getCountriesArray ()
getCountriesDropDown (line 357)

Gets the countries as an HTML drop down selector box (without the id_types)

string getCountriesDropDown ()
getCountriesHtml (line 334)

Gets the countries as an HTML table (without the id_types)

string getCountriesHtml ()
getCountryIdTypesArray (line 528)

Gets the id_types supported by the country specified by 2 character country code

array getCountryIdTypesArray (string $string)
  • string $string: 2 character country code
getCountryIdTypesDropDown (line 590)

Gets the id_types supported by the country specified by 2 character country code and returns an HTML dropdown selector box

string getCountryIdTypesDropDown (string $string)
  • string $string: 2 character country code
getCountryIdTypesHtml (line 560)

Gets the id_types supported by the country specified by 2 character country code and returns an HTML table

string getCountryIdTypesHtml (string $string)
  • string $string: 2 character country code
getCountryName (line 503)

Gets the country name by country code

string getCountryName (string $string)
  • string $string: 2 character country code
getData (line 724)

Gets the value for a field; returns null if field doesn't exist.

string getData (string $code)
  • string $code: field to be returned
getDataArray (line 739)

Gets the value for all fields and returns it as an array; returns null if field doesn't exist.

array getDataArray ()
getDataXML (line 958)

Returns all of the data submitted as a string in XML format for processing

string getDataXML ()
getErrorCode (line 857)

Returns the error code of the request (only AFTER submitRequest() has been run) If the result hasn't been recieved, IE no query made, returns null.

string getErrorCode ()
getErrorCodesXML (line 994)

Returns all of the error codes as a string in XML format for processing

string getErrorCodesXML ()
getErrorCodeText (line 874)

Returns the error code text of the request (only AFTER submitRequest() has been run) If the result hasn't been recieved, IE no query made, returns null.

string getErrorCodeText ()
getIrelandCountiesArray (line 429)

Gets the Ireland Counties as an array.

array getIrelandCountiesArray ()
getIrelandCountiesDropDown (line 459)

Gets the Ireland Counties as an HTML dropdown selector box.

string getIrelandCountiesDropDown ()
getIrelandCountiesHtml (line 440)

Gets the Ireland Counties as an HTML table.

string getIrelandCountiesHtml ()
getMatchCode (line 890)

Returns the match code of the request (only AFTER submitRequest() has been run) If the result hasn't been recieved, IE no query made, returns null.

string getMatchCode ()
getMatchCodesXML (line 1012)

Returns all of the match codes as a string in XML format for processing

string getMatchCodesXML ()
getMatchCodeText (line 906)

Returns the match code text of the request (only AFTER submitRequest() has been run) If the result hasn't been recieved, IE no query made, returns null.

string getMatchCodeText ()
getRawResult (line 1030)

Returns the result from submitRequest() without any modification.

string getRawResult ()
getResultXML (line 976)

Returns all of the data returned from submitRequest() as a string in XML format for processing

string getResultXML ()
getTransactionId (line 840)

Returns the transaction id of the request (only AFTER submitRequest() has been run) If the result hasn't been recieved, IE no query made, returns null.

string getTransactionId ()
getUsStatesArray (line 380)

Gets the US states as an array

array getUsStatesArray ()
getUsStatesDropDown (line 410)

Gets the US states as an HTML dropdown selector box.

string getUsStatesDropDown ()
getUsStatesHtml (line 391)

Gets the US states as an HTML table.

string getUsStatesHtml ()
isVerified (line 931)

The heart and soul. Populate data, then run this, it will do everything else for you.

This function will either:

Return the verification status of the the request if it has already been made.

OR

It will attempt to submit the data and verify it (pending at least the "sid" field is set).

This returns true if the person was successfully verified, otherwise they weren't verified for some reason, you'd have to check the error_code and/or match_code

boolean isVerified ()
makeRequest (line 766)

Create and parse the URL for verification based on all data collected thus far.

This requires the field "sid" to be set, if it isn't it returns null.

string makeRequest ()
newClass (line 302)

Forceably construct a new class instance, irregardless of current state.

Returns the new class instance self.

This function is only handy if you are using it in a stateless/persistant environment.

class newClass ()
parseResult (line 791)

Parses the result from the HTTP query and puts all the proper fields into an array.

array parseResult (string $string)
  • string $string: field to be returned
setCountry (line 479)

Sets the country to $string

boolean setCountry (string $string)
  • string $string: 2 character country code
setData (line 668)

Sets the any data to value; this is the preferred method to add any data to be submitted.

  • access: public
boolean setData (string $code, string $value)
  • string $code: field to be set
  • string $value: value of that field
setDataFromArray (line 708)

Sets the any data to value; this is the preferred method to add any data to be submitted.

An example of this in action is:

  1. require_once("libVerify.php");
  2. $vId = libVerify::getClass();
  3. $data = array (
  4. "sid" => "SIDASSIGNEDBYVERIFYME",
  5. "first" => "FirstName",
  6. "last" => "LastName",
  7. "country" => "US",
  8. "zip" => "43123",
  9. "dob" => "10/01/1960"
  10. )
  11. $vId::setDataFromArray($data);

  • access: public
boolean setDataFromArray (array $array)
  • array $array: values in field => data format
setIrelandCounty (line 620)

Sets the Ireland Country by 2 character Ireland county code

boolean setIrelandCounty (string $string)
  • string $string: 2 character Ireland County code
setUsState (line 644)

Sets the US State by 2 character state code

boolean setUsState (string $string)
  • string $string: 2 character Ireland County code
submitRequest (line 811)

Submits the request based on all current data.

boolean submitRequest ()

Documentation generated on Wed, 9 Feb 2005 23:00:53 -0500 by phpDocumentor 1.3.0RC3