<?php
//ini_set('display_errors',1);
//error_reporting(E_ALL);
include './Snoopy.class.php';
$snoopy = new Snoopy();


$arr = array (
  'act' => 'ome:order_fetch_url',
  'date' => '2012-07-13 11:51:01',
  'api_version' => '2.0',
  'return_data' => 'json',
  'tid' => '20120713111729',
  'notify_url' => 'aHR0cDovLzE5Mi4xNjguNjUuMjEwL29jc2x0Z3pfNDg1L2luZGV4LnBocD9hcHA9b21lJmN0bD1hZG1pbl9vcmRlciZhY3Q9dXBkYXRlX2lmcmFtZSZwWzBdPTIxMyZmaW5kZXJfaWQ9MzQ0NTBj',
  'ac' => '3a90f3976535ebde22fd9962fb1e9415',
);

foreach( $arr as &$v) {
    if ( !is_string($v) ) {
        $v = json_encode($v);
    } else {
        $v = stripslashes($v);
    }
}

header('content-type:application/json;charset=utf-8');
$snoopy->submit('http://192.168.65.210/ekdocs/api.php', $arr);

echo $snoopy->results;
$r = json_decode($snoopy->results,1);

//echo base_convert(ord($snoopy->results[0]),10,16),'-',ord($snoopy->results[1]),'-',ord($snoopy->results[2]);

function sign($params){
    if(!is_array($params))  return null;
    
    ksort($params);
    $sign = '';
    foreach($params AS $key=>$val){
        if ( 'token' == $key ) {
            $token = $val; continue;
        }
        $sign .= $key . $val;
    }
    return strtoupper(md5(strtoupper(md5($sign)).$token));
}
