0. 데이터 입력

<?php
header("Content-Type:text/html;charset=UTF-8");
 
$config->s_serv_url = 'woorimail.com'; 
$config->s_ssl = 'Y'; 
$config->s_ssl_port = '20080'; 
$config->s_authkey = 'thisiswoorimailauthkey'; 
$config->s_domain = 'mydomain.com'; 
 
$config->s_type = 'test';
 
$config->s_mid = 'auth_woorimail';
$config->s_act = 'dispWwapimanagerStatusApi';
 
$config->s_callback = ''; 
 
$s_serv_url = $config->s_serv_url;
 
if($config->s_ssl == 'N' || !$config->s_ssl) { 
  $s_ssl = 'http://'; 
  $s_ssl_port = ''; 
} elseif($config->s_ssl == 'Y') { 
  $s_ssl = 'https://'; 
  $s_ssl_port = ':' . $config->s_ssl_port; 
}
 
$url = $s_ssl . $s_serv_url . $s_ssl_port . '/index.php';
?>

 

1. HTML의 form 방식 전송

<html>
<head>
  <title>우리메일(http://woorimail.com) STATUS 예제</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
  <form action="<?=$url?>" method="post">
    <input type="hidden" name="act" value="<?=$config->s_act?>" />
    <input type="hidden" name="authkey" value="<?=$config->s_authkey?>" />
    <input type="hidden" name="mid" value="<?=$config->s_mid?>" />
    <input type="hidden" name="domain" value="<?=$config->s_domain?>" />
    <input type="hidden" name="type" value="<?=$config->s_type?>" />
    <input type="hidden" name="callback" value="<?=$config->s_callback?>" />
    <input type="submit" value="Get Status" />
  </form>
</body>
</html>

 

2. cURL 방식 전송

<?php
$post_data = array(
  'act' => $config->s_act,
  'authkey' => $config->s_authkey,
  'mid' => $config->s_mid,
  'domain' => $config->s_domain,
  'type' => $config->s_type,
  'is_sendok' => $config->s_is_send,
  'callback' => $config->s_callback
);
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
if($config->s_ssl == 'Y') {
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
}
 
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>

 

3. 결과값

callback이 없다면 결과값은 json 으로 표현됩니다.

정상 처리되었을 경우 json
{"free_point":"4","pay_point":"26","event_point":"0","etc_point":"9330","result":"OK","error_msg":null}

테스트 정상 통과 하였을 경우 json
{"result":"testOK","error_msg":""}

에러일 경우 json
{"result":"fail","error_msg":"auth error"}