steveosoule
11/10/2016 - 12:37 AM

Miva s.content_data to Read POST Data

Miva s.content_data to Read POST Data

<?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;
<h2>s.content_data</h2>
<pre><mvt:eval expr="s.content_data"/></pre>
<h2>miva_json_decode(s.content_data, l.settings:json)</h2>
<mvt:assign name="l.result" value="miva_json_decode(s.content_data, l.settings:json)" />
<p><b>&amp;mvt:json:foobar; =</b> &mvt:json:foobar;</p>
<p><b>&amp;mvt:json:message; =</b> &mvt:json:message;</p>