- Description: A method to retrieve information about campaign contributions from sectors
- 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->candidateIndustry( '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 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 | 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/industries.php?cid=N00000019&cycle=2008 [last_updated] => 03/02/2009 ) [industry] => Array ( [0] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Lawyers/Law Firms [indivs] => 20047966 [pacs] => 362245 [total] => 20410211 ) ) [1] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Retired [indivs] => 13633627 [pacs] => 0 [total] => 13633627 ) ) [2] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Securities & Investment [indivs] => 9079793 [pacs] => 104600 [total] => 9184393 ) ) [3] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Real Estate [indivs] => 8476719 [pacs] => 79100 [total] => 8555819 ) ) [4] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Business Services [indivs] => 5582470 [pacs] => 15500 [total] => 5597970 ) ) [5] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Education [indivs] => 5235830 [pacs] => 7000 [total] => 5242830 ) ) [6] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Women's Issues [indivs] => 5172022 [pacs] => 29920 [total] => 5201942 ) ) [7] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Health Professionals [indivs] => 4747286 [pacs] => 76666 [total] => 4823952 ) ) [8] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => TV/Movies/Music [indivs] => 4706863 [pacs] => 73888 [total] => 4780751 ) ) [9] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Misc Business [indivs] => 4067311 [pacs] => 5000 [total] => 4072311 ) ) [10] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Misc Finance [indivs] => 3365440 [pacs] => 0 [total] => 3365440 ) ) [11] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Civil Servants/Public Officials [indivs] => 2566691 [pacs] => 0 [total] => 2566691 ) ) [12] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Computers/Internet [indivs] => 2442082 [pacs] => 5570 [total] => 2447652 ) ) [13] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Democratic/Liberal [indivs] => 2398074 [pacs] => 45947 [total] => 2444021 ) ) [14] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Printing & Publishing [indivs] => 2041573 [pacs] => 3200 [total] => 2044773 ) ) [15] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Commercial Banks [indivs] => 1948358 [pacs] => 63650 [total] => 2012008 ) ) [16] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Insurance [indivs] => 1615890 [pacs] => 105300 [total] => 1721190 ) ) [17] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Lobbyists [indivs] => 1609010 [pacs] => 19500 [total] => 1628510 ) ) [18] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Misc Manufacturing & Distributing [indivs] => 1442635 [pacs] => 41000 [total] => 1483635 ) ) [19] => stdClass Object ( [@attributes] => stdClass Object ( [industry_name] => Accountants [indivs] => 1449789 [pacs] => 5000 [total] => 1454789 ) ) ) ) |



