PHP Classes
elePHPant
Icontem

File: demo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of David Barnes  >  Customers 2 Avoid API  >  demo.php  >  Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: Demo File
Class: Customers 2 Avoid API
Search for listed people using Customers2Avoid API
Author: By
Last change:
Date: 3 years ago
Size: 1,556 bytes
 

Contents

Class file image Download
<?php
include('c2a_api.php');

$api = new C2A;

$api->setUser('youremail@yahoo.com','yourpassword');

$data = $api->search('customersemail@customer.com','Joe','Smith','Acne Co','123 Demo Lane','Testville','ME','04105','US'); // Email, First Name, Last Name, Company, Address, City, State, Zip, Country

if($errors = $api->hasErrors()){
    echo
'The following error occurred: ';
    foreach(
$errors as $error){
        echo
'<br /> - '.$error;
    }
}else{
    echo
$api->numResults().' customers were found in the database <br /><br />';
   
    if(!empty(
$data['customers'])){
        foreach(
$data['customers'] as $customer){
            echo
'<hr />';
            echo
'Customer ID: '.$customer['id'] .'<br />'; // The customers reference ID # (currently irrelivant but might be used at a later date as we add more services)
           
echo 'Name: '.$customer['first_name'].' '.$customer['last_name'].'<br />';
            echo
'Company: '.$customer['company'].'<br />';
            echo
'Address: '.$customer['address'].'<br />';
            echo
'City: '.$customer['city'].'<br />';
            echo
'State: '.$customer['state'].'<br />';
            echo
'Zip: '.$customer['zip'].'<br />';
            echo
'Country: '.$customer['country'].'<br /><br>';
            echo
'Match Level: '.$customer['level'].'<br />'; // This number shows how many of your search fields were a match to the customer (the higher the number the more likely that you found the same person)
           
echo 'Reports: '.$customer['reports']; // This number shows how many reports have been submitted against the person (more reports = very bad customer)
       
}
    }
}
?>