Last active
December 20, 2018 00:10
-
-
Save steveosoule/4d92d62096245fefbc4c63bdc5f36361 to your computer and use it in GitHub Desktop.
Miva s.content_data & s.json_data to Read POST'd Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>s.json_data</h2> | |
<mvt:assign name="l.settings:json_v1" value="s.json_data" /> | |
<p><b>&mvt:json_v1:foobar; =</b> &mvt:json_v1:foobar;</p> | |
<p><b>&mvt:json_v1:message; =</b> &mvt:json_v1:message;</p> | |
<h2>s.content_data</h2> | |
<pre><mvt:eval expr="s.content_data"/></pre> | |
<mvt:assign name="l.result" value="miva_json_decode(s.content_data, l.settings:json_v2)" /> | |
<p><b>&mvt:json_v2:foobar; =</b> &mvt:json_v2:foobar;</p> | |
<p><b>&mvt:json_v2:message; =</b> &mvt:json_v2:message;</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$json = json_encode(array( | |
"foobar" => "baz", | |
"message" => "Hello World!" | |
)); | |
$ch = curl_init('https://ssoule.mivamerchantdev.com/mm5/merchant.mvc?Screen=accept-json'); | |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $json); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array( | |
'Content-Type: application/json', | |
'Content-Length: ' . strlen($json)) | |
); | |
$result = curl_exec($ch); | |
echo $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment