scragg0x/votesmart-php

votesmart.org API 包装器,使用 php 实现

dev-master 2013-07-06 18:41 UTC

This package is not auto-updated.

Last update: 2024-09-23 14:44:10 UTC


README

votesmart.org 的一个非常简单的 API 包装器。

安装

推荐的方式是通过 composer。只需创建一个 composer.json 文件,并运行 php composer.phar install 命令即可安装。

{
    "require": {
        "scragg0x/votesmart-php": "dev-master"
    }
}

API 参考

http://votesmart.org/share/api

示例

require_once __DIR__ . "/../vendor/autoload.php";

use VoteSmart\Client;

// You need to obtain a key
$key = '';

$c = new Client($key, 'json');

print_r( $c->get('Officials.getByZip', array('zip5' => 76131))->json() );