<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
function send_message($method, $request = array()) {
$request = xmlrpc_encode_request($method, $request);
$context = stream_context_create(
array('http' => array(
'timeout' => 160,
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)
)
);
$file = file_get_contents("URL", false, $context);
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response)){
trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
return $response;
}
}
$md_request = array($kode_produk,$idpel1,$idpel2,$idpel3,$uid,$pin,$ref1);
$md_method = 'METHOD_NAME';
$md_response = send_message($md_method,$md_request);
echo "<pre>", print_r($md_response) ,"</pre>";
echo json_encode($md_response);
?>