- Description: A method to retrieve information about campaign contributions from contributors.
- Arguments: Requires unique member_id that represents the candidate ID (cid) as provided by OpenSecrets. The OpenSecrets API is documented here along with sources for some obscure data. Additionally, it takes an optional 4-digit calendar year for election cycle.
- Special Note: The OpenSecrets API is different from the Sunlight Labs API. Though they share some of the same functionality for the purposes of this library, it is important to set the proper API endpoint and secure an OpenSecrets API Key. Also, be aware of rate limits and develop accordingly.
1 2 3 4 5 6 7 8 | api_key = 'XXXXXXXXXXXX'; $os->request_url = 'http://www.opensecrets.org/api/'; $os->rate_limit = 200; echo '<pre>'; print_r( $os->candidateContributors( 'N00000019', '2008' ) ); echo '</pre>'; ?> |
Result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | stdClass Object ( [@attributes] => stdClass Object ( [cand_name] => Hillary Clinton (D) [cid] => N00000019 [cycle] => 2008 [origin] => Center for Responsive Politics [source] => http://www.opensecrets.org/politicians/contrib.php?cid=N00000019&cycle=2008 [notice] => The organizations themselves did not donate, rather the money came from the organization's PAC, its individual members or employees or owners, and those individuals' immediate families. ) [contributor] => Array ( [0] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Citigroup Inc [total] => 672577 ) ) [1] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Goldman Sachs [total] => 608520 ) ) [2] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => DLA Piper [total] => 552420 ) ) [3] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => EMILY's List [total] => 528520 ) ) [4] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Morgan Stanley [total] => 511640 ) ) [5] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => JPMorgan Chase & Co [total] => 412429 ) ) [6] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Skadden, Arps et al [total] => 339940 ) ) [7] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Lehman Brothers [total] => 319543 ) ) [8] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => Time Warner [total] => 316986 ) ) [9] => stdClass Object ( [@attributes] => stdClass Object ( [org_name] => University of California [total] => 308807 ) ) ) ) |



