SunlightLegislator::legislatorSearch()

  • Description: A search method that looks for legislators by name.
  • Arguments: A string representing a name or portion of a name of a legislator.
1
2
3
4
5
6
api_key = 'XXXXXXXXXXXX';

echo '<pre>';
print_r( $sf-&gt;legislatorSearch( 'Kennedy' ) );
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
stdClass Object
(
    [0] =&gt; stdClass Object
        (
            [result] =&gt; stdClass Object
                (
                    [score] =&gt; 1
                    [legislator] =&gt; stdClass Object
                        (
                            [district] =&gt; 1
                            [title] =&gt; Rep
                            [eventful_id] =&gt; P0-001-000016396-4
                            [in_office] =&gt; 1
                            [state] =&gt; RI
                            [crp_id] =&gt; N00000360
                            [official_rss] =&gt;
                            [party] =&gt; D
                            [email] =&gt; patrick.kennedy@mail.house.gov
                            [votesmart_id] =&gt; 22207
                            [website] =&gt; http://patrickkennedy.house.gov/
                            [fax] =&gt; 202-225-3290
                            [govtrack_id] =&gt; 400215
                            [firstname] =&gt; Patrick
                            [middlename] =&gt; Joseph
                            [lastname] =&gt; Kennedy
                            [congress_office] =&gt; 407 Cannon House Office Building
                            [phone] =&gt; 202-225-4911
                            [webform] =&gt; https://forms.house.gov/formpatrickkennedy/IMA/contact.htm
                            [youtube_url] =&gt;
                            [nickname] =&gt;
                            [bioguide_id] =&gt; K000113
                            [fec_id] =&gt; H4RI01034
                            [gender] =&gt; M
                            [senate_class] =&gt;
                            [name_suffix] =&gt;
                            [twitter_id] =&gt;
                            [sunlight_old_id] =&gt; fakeopenID207
                            [congresspedia_url] =&gt; http://www.opencongress.org/wiki/Patrick_Joseph_Kennedy
                        )

                )

        )

    [1] =&gt; stdClass Object
        (
            [result] =&gt; stdClass Object
                (
                    [score] =&gt; 1
                    [legislator] =&gt; stdClass Object
                        (
                            [district] =&gt; Senior Seat
                            [title] =&gt; Sen
                            [eventful_id] =&gt; P0-001-000016085-1
                            [in_office] =&gt; 1
                            [state] =&gt; MA
                            [crp_id] =&gt; N00000308
                            [official_rss] =&gt;
                            [party] =&gt; D
                            [email] =&gt;
                            [votesmart_id] =&gt; 53305
                            [website] =&gt; http://kennedy.senate.gov/
                            [fax] =&gt; 202-224-2417
                            [govtrack_id] =&gt; 300059
                            [firstname] =&gt; Edward
                            [middlename] =&gt; M.
                            [lastname] =&gt; Kennedy
                            [congress_office] =&gt; 317 Russell Senate Office Building
                            [phone] =&gt; 202-224-4543
                            [webform] =&gt; http://kennedy.senate.gov/senator/contact.cfm
                            [youtube_url] =&gt;
                            [nickname] =&gt; Ted
                            [bioguide_id] =&gt; K000105
                            [fec_id] =&gt; S6MA00015
                            [gender] =&gt; M
                            [senate_class] =&gt; I
                            [name_suffix] =&gt; Sr.
                            [twitter_id] =&gt;
                            [sunlight_old_id] =&gt; fakeopenID487
                            [congresspedia_url] =&gt; http://www.opencongress.org/wiki/Edward_Kennedy
                        )

                )

        )

)