関数使用例(PHP 版)

Yubin7 Toolkit は 2017 年 10 月 30 日 をもって販売を終了いたしました。

関数名をクリックするとコード例を表示します。

ZipDic.php が提供する関数一覧

GetZipAddress 郵便番号を元に郵便番号辞書から該当する住所文字列を取得します。
<?php
// 外部ファイル ZipDic.php 読み込み
require_once('ZipDic.php');

// ZipDic クラスのインスタンスを生成
$wZipDic = new ZipDic();
// 郵便番号を元に住所データを取得
$zipcode = "918-8239";
$result = $wZipDic->GetZipAddress($zipcode);
?>
<html>
    <head>
        <title>GetZipAddress 関数 - サンプルソース</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        // 結果を表示
        print("7桁郵便場号 : " . $result[0]["ZipCode"] . "<br>");
        print("市町村コード : " . $result[0]["CityCode"] . "<br>");
        print("都道府県 : " . $result[0]["PrefName"] . "<br>");
        print("市名1 : " . $result[0]["CountyName"] . "<br>");
        print("市名2 : " . $result[0]["CityName"] . "<br>");
        print("町域名 : " . $result[0]["TownName"]);
        ?>
    </body>
</html>

ZipDic2.php が提供する関数一覧

Yubin7 住所文字列を元に郵便番号辞書から該当する郵便番号を取得します。
<?php
// 外部ファイル ZipDic2.php 読み込み
require_once('ZipDic2.php');

// ZipDic2 クラスのインスタンスを生成
$wZipDic2 = new ZipDic2();
// 住所データを元に郵便番号を取得
$address = "福井県福井市成和1丁目2816番地";
$result = $wZipDic2->Yubin7($address);
?>
<html>
    <head>
        <title>Yubin7 関数 - サンプルソース</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        // 結果を表示
        print("ステータス(取得有無) : " . $result["Status"] . "<br>");
        print("7桁郵便場号 : " . $result["ZipCode"] . "<br>");
        print("市町村コード : " . $result["CityCode"] . "<br>");
        print("都道府県 : " . $result["PrefName"] . "<br>");
        print("市名1 : " . $result["CountyName"] . "<br>");
        print("市名2 : " . $result["CityName"] . "<br>");
        print("町域名 : " . $result["TownName"] . "<br>");
        print("町域以降 : " . $result["Number"] . "<br>");
        Print("エラー詳細 : " . $result["Error"]);
        ?>
    </body>
</html>

ZipDicProp.php が提供する関数一覧

GetDicDownloadURL 製品シリアルNo と指定した郵便番号辞書のバージョンを元に、辞書ダウンロード用 URL を取得します。
取得された URL にアクセスすることで最新の郵便番号辞書をダウンロードすることが可能です。
<?php
// 外部ファイル ZipDicProp.php 読み込み
require_once('ZipDicProp.php');

// ZipDicProp クラスのインスタンスを生成
$wZipDicProp = new ZipDicProp();

$wSerial = "12345678";          // シリアルNo
$wDicVersion = "161.0.0.01 ";  // 辞書バージョン
/* GetDicVersion 関数との併用例
 * 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
 * $wDicVersion = $wZipDicProp->GetDicVersion("dicVersion");
 */

// 郵便番号辞書ダウンロード専用 URL の取得
$wURL = $wZipDicProp->GetDicDownloadURL($wSerial, $wDicVersion);
?>
<html>
    <head>
        <title>GetDicDownloadURL 関数 - サンプルソース</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        // 結果を表示
        print("ダウンロードサイト URL : " . $wURL);
        ?>
    </body>
</html>
GetDicVersion 指定した郵便番号辞書のバージョン情報を取得します。
<?php
// 外部ファイル ZipDicProp.php 読み込み
require_once('ZipDicProp.php');

// ZipDicProp クラスのインスタンスを生成
$wZipDicProp = new ZipDicProp();

// 郵便番号辞書(AdvZip.Dic)ファイルバージョン取得
$wDicVersion = $wZipDicProp->GetDicVersion("dicVersion");           // 辞書バージョン
$wReleaseData = $wZipDicProp->GetDicVersion("releaseDate");         // データ公開日
$wAssureDate = $wZipDicProp->GetDicVersion("assureDate");           // データ保障日
$wCreateDate = $wZipDicProp->GetDicVersion("createDate");           // ファイル生成日
$wAdvZipDicClass = $wZipDicProp->GetDicVersion("advZipDicClass");   // AdvZipDicクラスバージョン
?>
<html>
    <head>
        <title>GetDicDownloadURL 関数 - サンプルソース</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        // 結果を表示
        print("辞書バージョン : " . $wDicVersion . "<br>");
        print("データ公開日 : " . $wReleaseData . "<br>");
        print("データ保障日 : " . $wAssureDate . "<br>");
        print("ファイル生成日 : " . $wCreateDate . "<br>");
        print("AdvZipDicクラスバージョン : " . $wAdvZipDicClass);
        ?>
    </body>
</html>

提供関数の実際の動作を確認することが可能な動作デモページを公開しております。