OpenSecretsCandidate::candidateContributors()

  • 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-&gt;candidateContributors( '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
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/contrib.php?cid=N00000019&amp;cycle=2008
            [notice] =&gt; 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] =&gt; Array
        (
            [0] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Citigroup Inc
                            [total] =&gt; 672577
                        )

                )

            [1] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Goldman Sachs
                            [total] =&gt; 608520
                        )

                )

            [2] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; DLA Piper
                            [total] =&gt; 552420
                        )

                )

            [3] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; EMILY's List
                            [total] =&gt; 528520
                        )

                )

            [4] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Morgan Stanley
                            [total] =&gt; 511640
                        )

                )

            [5] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; JPMorgan Chase &amp; Co
                            [total] =&gt; 412429
                        )

                )

            [6] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Skadden, Arps et al
                            [total] =&gt; 339940
                        )

                )

            [7] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Lehman Brothers
                            [total] =&gt; 319543
                        )

                )

            [8] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; Time Warner
                            [total] =&gt; 316986
                        )

                )

            [9] =&gt; stdClass Object
                (
                    [@attributes] =&gt; stdClass Object
                        (
                            [org_name] =&gt; University of California
                            [total] =&gt; 308807
                        )

                )

        )

)