Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rest-api-examples
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
snac
rest-api-examples
Commits
e4c44282
Commit
e4c44282
authored
Feb 07, 2017
by
Robbie Hott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added better comments
parent
7d3d60f3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
cbwcsv.php
reconciliation/cbw_example/cbwcsv.php
+5
-1
cbwhtml.php
reconciliation/cbw_example/cbwhtml.php
+5
-1
No files found.
reconciliation/cbw_example/cbwcsv.php
View file @
e4c44282
...
@@ -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
)
{
...
...
reconciliation/cbw_example/cbwhtml.php
View file @
e4c44282
...
@@ -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>"
.
" searched:
$name
\n
<ul>"
;
" 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment