/digital-address.php

郵便番号・デジタルアドレスAPIのサーバーサイドのコードです。 レンタルサーバーやVPSやe2-microなどのクラウドサーバーで動作します。

Primary LanguagePHPMIT LicenseMIT

その他実装:Vercel Functions Cloudflare Workers Deno Deploy

郵便番号・デジタルアドレスAPI

郵便番号・デジタルアドレスAPIのサーバーサイドのコードです。

セットアップ

0. システム登録

IPアドレス 127.0.0.1 を設定してください

image

1. index.phpと.htaccessをアップロード

2. credentials.jsonの作成

credentials.json

{
    "grant_type": "client_credentials",
    "client_id": "your-client_id",
    "secret_key": "your-secret_key"
}

Important

公開ディレクトリに置かないように、credentials.jsonaccess_token.jsonのパスを変更できます。

3. 動作確認

# .htaccessが有効な場合
curl http://example.com/1000001
# .htaccessが無効な場合
curl http://example.com/index.php?search_code=1000001