- Description: A search method to retrieve summary data about contributions to a specified candidate from a specified industry.
- Arguments: Requires unique member_id and a unique industry_id that represents the candidate ID (cid) and industry code 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->candidateIndustryContribution( 'N00000019', 'A01', '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 | stdClass Object ( [@attributes] => stdClass Object ( [cand_name] => Clinton, Hillary [cid] => N00000019 [cycle] => 2008 [industry] => Crop Production [chamber] => S [party] => D [state] => New York [total] => 206741 [indivs] => 199941 [pacs] => 6800 [rank] => 5 [origin] => Center for Responsive Politics [source] => http://www.opensecrets.org/industries/recips.php?Ind=A01&cycle=2008&recipdetail=S&Mem=Y&sortorder=U [last_updated] => 3/2/09 ) ) |



