OpenSecretsCandidate::candidateSector()

  • 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-&gt;candidateSector( 'N00000019', '2008' ) );
echo '</pre>';
?&gt;

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] =&gt; stdClass Object
        (
            [cand_name] =&gt; Hillary Clinton (D)
            [cid] =&gt; N00000019
            [cycle] =&gt; 2008
            [origin] =&gt; Center for Responsive Politics
            [source] =&gt; http://www.opensecrets.org/politicians/industries.php?cid=N00000019&amp;cycle=2008
            [last_updated] =&gt; 03/02/2009
        )

    [sector] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Agribusiness
                            [sectorid] =&gt; A
                            [indivs] =&gt; 1087577
                            [pacs] =&gt; 41100
                            [total] =&gt; 1128677
                        )

                )

            [1] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Communic/Electronics
                            [sectorid] =&gt; B
                            [indivs] =&gt; 10450340
                            [pacs] =&gt; 181258
                            [total] =&gt; 10631598
                        )

                )

            [2] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Construction
                            [sectorid] =&gt; C
                            [indivs] =&gt; 3384715
                            [pacs] =&gt; 64240
                            [total] =&gt; 3448955
                        )

                )

            [3] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Defense
                            [sectorid] =&gt; D
                            [indivs] =&gt; 477068
                            [pacs] =&gt; 63800
                            [total] =&gt; 540868
                        )

                )
            [4] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Energy/Nat Resource
                            [sectorid] =&gt; E
                            [indivs] =&gt; 1215904
                            [pacs] =&gt; 66192
                            [total] =&gt; 1282096
                        )

                )

            [5] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Finance/Insur/RealEst
                            [sectorid] =&gt; F
                            [indivs] =&gt; 26277394
                            [pacs] =&gt; 389150
                            [total] =&gt; 26666544
                        )

                )

            [6] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Health
                            [sectorid] =&gt; H
                            [indivs] =&gt; 7871958
                            [pacs] =&gt; 257366
                            [total] =&gt; 8129324
                        )

                )

            [7] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Lawyers &amp; Lobbyists
                            [sectorid] =&gt; K
                            [indivs] =&gt; 21656976
                            [pacs] =&gt; 381745
                            [total] =&gt; 22038721
                        )

                )

            [8] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Transportation
                            [sectorid] =&gt; M
                            [indivs] =&gt; 956306
                            [pacs] =&gt; 53600
                            [total] =&gt; 1009906
                        )

                )

            [9] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Misc Business
                            [sectorid] =&gt; N
                            [indivs] =&gt; 16090562
                            [pacs] =&gt; 189017
                            [total] =&gt; 16279579
                        )

                )

            [10] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Labor
                            [sectorid] =&gt; P
                            [indivs] =&gt; 211940
                            [pacs] =&gt; 524184
                            [total] =&gt; 736124
                        )

                )

            [11] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Ideology/Single-Issue
                            [sectorid] =&gt; Q
                            [indivs] =&gt; 9794700
                            [pacs] =&gt; 810776
                            [total] =&gt; 10605476
                        )

                )

            [12] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [sector_name] =&gt; Other
                            [sectorid] =&gt; W
                            [indivs] =&gt; 23961912
                            [pacs] =&gt; 10500
                            [total] =&gt; 23972412
                        )

                )

        )

)