Reviews



[insert_php]

// Configuration parameters to make changes easier.
$ClientID =”1801″;
$NumberToDisplay = “100”;
$Threshold = “7”;
$Complete = “1”;

$xml_feed_url = ‘http://my.rossware.net/GetReviewsAsXML.php?ClientID=’. $ClientID .’&limit=’. $NumberToDisplay .’&complete=’. $Complete .’&avg=’ . $Threshold;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $xml_feed_url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);

function produce_XML_object_tree($raw_XML) {
libxml_use_internal_errors(true);
try {
$xmlTree = new SimpleXMLElement($raw_XML);
} catch (Exception $e) {
// Something went wrong.
$error_message = ‘SimpleXMLElement threw an exception.’;
foreach(libxml_get_errors() as $error_line) {
$error_message .= “\t” . $error_line->message;
}
trigger_error($error_message);
return false;
}
return $xmlTree;
}

$feed = produce_XML_object_tree($xml);
$entry_count = 0;

foreach ($feed->Review as $Review) {

$Comments = $Review->CstmrCmnts;
$Comments = preg_replace(‘/[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i’,'(phone hidden)’,$Comments); // extract email
$Comments = preg_replace(‘/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?/’,'(email hidden)’,$Comments); // extract phonenumber
$Comments = stripslashes(html_entity_decode(str_replace(“\r\n”, ” “, $Comments)));

echo ‘

‘ . date( ‘m-d-Y’, strtotime($Review->CmpltDate)) . ““;
echo ‘‘;
echo ‘

‘. $Review->avg .’‘ . $Comments .’

‘;
echo “

\r\n”;
$entry_count++;
}
if ($entry_count < 1) { echo '

No results to display.

‘;
}
[/insert_php]