- Description: A method to retrieve information about top sector contributions to a specified candidate.
- 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->candidateSector( '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 | 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 ) [sector] => Array ( [0] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Agribusiness [sectorid] => A [indivs] => 1087577 [pacs] => 41100 [total] => 1128677 ) ) [1] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Communic/Electronics [sectorid] => B [indivs] => 10450340 [pacs] => 181258 [total] => 10631598 ) ) [2] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Construction [sectorid] => C [indivs] => 3384715 [pacs] => 64240 [total] => 3448955 ) ) [3] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Defense [sectorid] => D [indivs] => 477068 [pacs] => 63800 [total] => 540868 ) ) [4] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Energy/Nat Resource [sectorid] => E [indivs] => 1215904 [pacs] => 66192 [total] => 1282096 ) ) [5] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Finance/Insur/RealEst [sectorid] => F [indivs] => 26277394 [pacs] => 389150 [total] => 26666544 ) ) [6] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Health [sectorid] => H [indivs] => 7871958 [pacs] => 257366 [total] => 8129324 ) ) [7] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Lawyers & Lobbyists [sectorid] => K [indivs] => 21656976 [pacs] => 381745 [total] => 22038721 ) ) [8] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Transportation [sectorid] => M [indivs] => 956306 [pacs] => 53600 [total] => 1009906 ) ) [9] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Misc Business [sectorid] => N [indivs] => 16090562 [pacs] => 189017 [total] => 16279579 ) ) [10] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Labor [sectorid] => P [indivs] => 211940 [pacs] => 524184 [total] => 736124 ) ) [11] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Ideology/Single-Issue [sectorid] => Q [indivs] => 9794700 [pacs] => 810776 [total] => 10605476 ) ) [12] => stdClass Object ( [@attributes] => stdClass Object ( [sector_name] => Other [sectorid] => W [indivs] => 23961912 [pacs] => 10500 [total] => 23972412 ) ) ) ) |



