Retrieving Search Results
This script shows a sample of how to retrieve results. In this case it is searching people and returning them as an array (which you could use to import into your own web application):
Code:
<?php
function SendtoHeap($whattosend,$URL,$email,$password){
$URL = $URL . "/api.php";
$stringtosend = "login_email=" . urlencode($email) . "&login_password=" . urlencode($password);
foreach($whattosend as $key=>$value){
$stringtosend = $stringtosend . "&" . $key . "=" . urlencode($value);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $stringtosend);
$storage = curl_exec ($ch);
curl_close ($ch);
return $storage;
}
function ReturnPersonArray($URL,$email,$password,$search){
$get = array();
$get['get'] = "people";
$get['search'] = $search;
$storage = SendtoHeap($get,$URL,$email,$password);
try{
$sxe = new SimpleXMLElement($storage);
} catch (Exception $e) {
return "Could not read XML";
}
$returnarray = array();
foreach($sxe->person as $person){
$returnrow = array();
$returnrow['name'] = $person->name;
$returnrow['title'] = $person->title;
$returnrow['phone'] = $person->phone;
$returnrow['mobile'] = $person->mobile;
$returnrow['fax'] = $person->fax;
$returnrow['email'] = $person->email;
$returnrow['url'] = $person->url;
$returnrow['address'] = $person->address;
$returnrow['city'] = $person->city;
$returnrow['state'] = $person->state;
$returnrow['zip'] = $person->zip;
$returnrow['country'] = $person->country;
$returnrow['update'] = $person->update;
$returnarray[] = $returnrow;
}
return $returnarray;
}
var_dump(ReturnPersonArray("https://creativearc.crmondemand.biz","ben@wbpsystems.com","password","search phrase"));
?>
You can do exactly the same advanced searches here as you can within Heap. For information on operators, bucket selectors and more, please refer to http://heap.wbpsystems.com/find.php.











![[SECURE] File Send](http://www.wbpsystems.com/lib/filesendbrown.gif)