Commit e4c44282 by Robbie Hott

Added better comments

parent 7d3d60f3
...@@ -52,7 +52,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -52,7 +52,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
$name = $name_only; $name = $name_only;
} }
// Build a SNAC Identity Constellation Array (JSON object) // Build a SNAC query with an Identity Constellation Array (JSON object)
$snacArray = array( $snacArray = array(
"command" => "reconcile", "command" => "reconcile",
"constellation" => array ( "constellation" => array (
...@@ -67,6 +67,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -67,6 +67,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
) )
); );
// Encode Associative Array as JSON object
$query = json_encode($snacArray, JSON_PRETTY_PRINT); $query = json_encode($snacArray, JSON_PRETTY_PRINT);
// Use CURL to send reconciliation request to the REST API // Use CURL to send reconciliation request to the REST API
...@@ -83,7 +84,10 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -83,7 +84,10 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
$responseJSON = curl_exec($ch); $responseJSON = curl_exec($ch);
curl_close($ch); curl_close($ch);
// Decode JSON response into an Associative Array
$response = json_decode($responseJSON, true); $response = json_decode($responseJSON, true);
// If reconciliation succeeded, then process the results
if (isset($response["reconciliation"])) { if (isset($response["reconciliation"])) {
foreach ($response["reconciliation"] as $i => $result) { foreach ($response["reconciliation"] as $i => $result) {
......
...@@ -72,7 +72,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -72,7 +72,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
echo "<li>" . $name_only . ", ".$data[12]. " (" . $data[0].") : \n<br>" . echo "<li>" . $name_only . ", ".$data[12]. " (" . $data[0].") : \n<br>" .
"&nbsp;&nbsp;searched: $name\n<ul>"; "&nbsp;&nbsp;searched: $name\n<ul>";
// Build a SNAC Identity Constellation Array (JSON object) // Build a SNAC query with an Identity Constellation Array (JSON object)
$snacArray = array( $snacArray = array(
"command" => "reconcile", "command" => "reconcile",
"constellation" => array ( "constellation" => array (
...@@ -87,6 +87,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -87,6 +87,7 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
) )
); );
// Encode Associative Array as JSON object
$query = json_encode($snacArray, JSON_PRETTY_PRINT); $query = json_encode($snacArray, JSON_PRETTY_PRINT);
// Use CURL to send reconciliation request to the REST API // Use CURL to send reconciliation request to the REST API
...@@ -103,7 +104,10 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) { ...@@ -103,7 +104,10 @@ if (isset($argv[1]) && (($handle = fopen($argv[1], "r")) !== FALSE)) {
$responseJSON = curl_exec($ch); $responseJSON = curl_exec($ch);
curl_close($ch); curl_close($ch);
// Decode JSON response into an Associative Array
$response = json_decode($responseJSON, true); $response = json_decode($responseJSON, true);
// If reconciliation succeeded, then process the results
if (isset($response["reconciliation"])) { if (isset($response["reconciliation"])) {
foreach ($response["reconciliation"] as $i => $result) { foreach ($response["reconciliation"] as $i => $result) {
// Round the strength to a manageable precision // Round the strength to a manageable precision
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment