SunlightLegislator::legislatorZipCode()

  • Description: A search method that looks for legislators by zip code. This will return data for all legislative districts in the given zip code.
  • Arguments: An 5-digit integer representing a USPS zip code.
1
2
3
4
5
6
api_key = 'XXXXXXXXXXXX';

echo '<pre>';
print_r( $sf-&gt;legislatorZipCode( 20817 ) );
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
stdClass Object
(
    [0] =&gt; stdClass Object
        (
            [legislator] =&gt; stdClass Object
                (
                    [district] =&gt; Junior Seat
                    [title] =&gt; Sen
                    [eventful_id] =&gt; P0-001-000016194-8
                    [in_office] =&gt; 1
                    [state] =&gt; MD
                    [crp_id] =&gt; N00001955
                    [official_rss] =&gt; http://cardin.senate.gov/
                    [party] =&gt; D
                    [email] =&gt;
                    [votesmart_id] =&gt; 26888
                    [website] =&gt; http://cardin.senate.gov/
                    [fax] =&gt; 202-224-1651
                    [govtrack_id] =&gt; 400064
                    [firstname] =&gt; Benjamin
                    [middlename] =&gt; L.
                    [lastname] =&gt; Cardin
                    [congress_office] =&gt; 509 Hart Senate Office Building
                    [phone] =&gt; 202-224-4524
                    [webform] =&gt; http://cardin.senate.gov/contact/email.cfm
                    [youtube_url] =&gt; http://www.youtube.com/SenatorCardin
                    [nickname] =&gt; Ben
                    [bioguide_id] =&gt; C000141
                    [fec_id] =&gt; H6MD03177
                    [gender] =&gt; M
                    [senate_class] =&gt; I
                    [name_suffix] =&gt;
                    [twitter_id] =&gt;
                    [sunlight_old_id] =&gt; fakeopenID452
                    [congresspedia_url] =&gt; http://www.opencongress.org/wiki/Benjamin_Cardin
                )

        )

    [1] =&gt; stdClass Object
        (
            [legislator] =&gt; stdClass Object
                (
                    [district] =&gt; 8
                    [title] =&gt; Rep
                    [eventful_id] =&gt; P0-001-000016655-4
                    [in_office] =&gt; 1
                    [state] =&gt; MD
                    [crp_id] =&gt; N00013820
                    [official_rss] =&gt;
                    [party] =&gt; D
                    [email] =&gt;
                    [votesmart_id] =&gt; 6098
                    [website] =&gt; http://vanhollen.house.gov
                    [fax] =&gt; 202-225-0375
                    [govtrack_id] =&gt; 400415
                    [firstname] =&gt; Christopher
                    [middlename] =&gt;
                    [lastname] =&gt; Van Hollen
                    [congress_office] =&gt; 1707 Longworth House Office Building
                    [phone] =&gt; 202-225-5341
                    [webform] =&gt; http://vanhollen.house.gov/HoR/MD08/Contact+Information/Web+Contact/Contact+Form.htm
                    [youtube_url] =&gt;
                    [nickname] =&gt; Chris
                    [bioguide_id] =&gt; V000128
                    [fec_id] =&gt; H2MD08126
                    [gender] =&gt; M
                    [senate_class] =&gt;
                    [name_suffix] =&gt; Jr.
                    [twitter_id] =&gt;
                    [sunlight_old_id] =&gt; fakeopenID406
                    [congresspedia_url] =&gt; http://www.opencongress.org/wiki/Christopher_Van_Hollen
                )

        )

    [2] =&gt; stdClass Object
        (
            [legislator] =&gt; stdClass Object
                (
                    [district] =&gt; Senior Seat
                    [title] =&gt; Sen
                    [eventful_id] =&gt; P0-001-000016100-9
                    [in_office] =&gt; 1
                    [state] =&gt; MD
                    [crp_id] =&gt; N00001945
                    [official_rss] =&gt;
                    [party] =&gt; D
                    [email] =&gt;
                    [votesmart_id] =&gt; 53304
                    [website] =&gt; http://mikulski.senate.gov/
                    [fax] =&gt; 202-224-8858
                    [govtrack_id] =&gt; 300073
                    [firstname] =&gt; Barbara
                    [middlename] =&gt; A.
                    [lastname] =&gt; Mikulski
                    [congress_office] =&gt; 503 Hart Senate Office Building
                    [phone] =&gt; 202-224-4654
                    [webform] =&gt; http://mikulski.senate.gov/Contact/contact.cfm
                    [youtube_url] =&gt;
                    [nickname] =&gt;
                    [bioguide_id] =&gt; M000702
                    [fec_id] =&gt; S6MD00140
                    [gender] =&gt; F
                    [senate_class] =&gt; III
                    [name_suffix] =&gt;
                    [twitter_id] =&gt;
                    [sunlight_old_id] =&gt; fakeopenID505
                    [congresspedia_url] =&gt; http://www.opencongress.org/wiki/Barbara_Mikulski
                )

        )

)