-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgetdata.php
224 lines (217 loc) · 8.19 KB
/
getdata.php
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
$data = array(
array("A. P. Møller - Mærsk", "51.2", "up"),
array("AT&T Inc.", "118.9", "up"),
array("AXA", "138.4", "up"),
array("Aegon", "57.7", "none"),
array("Ahold", "59.2", "down"),
array("Allianz", "151.0", "none"),
array("Altria Group", "73.8", "none"),
array("American International Group", "110.1", "down"),
array("AmerisourceBergen", "66.7", "up"),
array("Arcelor Mittal", "105.2", "up"),
array("Archer Daniels Midland", "52.9", "down"),
array("Assicurazioni Generali", "122.6", "down"),
array("Aviva", "97.8", "up"),
array("BASF", "84.6", "down"),
array("BHP Billiton", "59.5", "down"),
array("BMW", "82.5", "up"),
array("BNP Paribas", "116.2", "none"),
array("BP plc", "292.0", "up"),
array("BT Group plc", "41.2", "down"),
array("Banco Bilbao Vizcaya Argentaria", "54.8", "up"),
array("Bank of America", "119.2", "up"),
array("Barclays Bank", "79.7", "up"),
array("Bayer", "47.7", "none"),
array("Berkshire Hathaway", "118.3", "up"),
array("Boeing", "66.4", "down"),
array("Bouygues", "43.6", "up"),
array("Bunge Limited", "44.8", "up"),
array("CNP Assurances", "54.2", "down"),
array("CVS Caremark", "76.3", "up"),
array("Canon Inc.", "40.1", "none"),
array("Cardinal Health", "89.4", "up"),
array("Cargill", "88.3", "up"),
array("Carrefour", "135.8", "down"),
array("Caterpillar Inc.", "45.0", "none"),
array("Chevron Corp.", "214.1", "up"),
array("China Mobile", "48.9", "none"),
array("Chrysler", "49.0", "down"),
array("Citigroup", "81.7", "up"),
array("Commerzbank", "40.0", "none"),
array("ConocoPhillips", "187.4", "up"),
array("Costco", "67.9", "none"),
array("Credit Suisse", "83.7", "up"),
array("Crédit Agricole", "101.6", "down"),
array("Daimler AG", "146.3", "up"),
array("Dell", "61.1", "down"),
array("Deutsche Bahn", "46.1", "down"),
array("Deutsche Bank", "95.5", "up"),
array("Deutsche Post", "93.5", "down"),
array("Deutsche Telekom", "92.0", "up"),
array("Dexia", "140.8", "down"),
array("Dow Chemical", "53.5", "none"),
array("E.ON", "95.8", "down"),
array("EADS", "52.0", "up"),
array("ENEL", "49.5", "none"),
array("Electricité de France", "81.6", "up"),
array("Eni", "128.3", "up"),
array("ExxonMobil", "477.3", "up"),
array("Federal Home Loan Mortgage Corporation", "43.1", "up"),
array("Federal National Mortgage Association", "44.8", "none"),
array("Fiat", "86.2", "down"),
array("Ford Motor Company", "172.5", "none"),
array("Fortis", "121.2", "none"),
array("France Télécom", "77.3", "down"),
array("Fujitsu", "43.4", "none"),
array("Gaz de France", "40.4", "down"),
array("Gazprom", "69.6", "up"),
array("General Electric", "169.7", "down"),
array("General Motors", "149.0", "down"),
array("GlaxoSmithKline", "45.1", "none"),
array("Glencore International", "142.3", "down"),
array("Goldman Sachs", "88.0", "none"),
array("Groupe Casino", "53.1", "none"),
array("Grupo Santander", "72.3", "up"),
array("HBOS", "100.3", "up"),
array("HSBC", "79.0", "up"),
array("Hewlett-Packard", "107.7", "up"),
array("Hitachi, Ltd.", "113.1", "up"),
array("Hoffmann-La Roche", "40.7", "up"),
array("Home Depot, Inc.", "77.4", "down"),
array("Honda", "119.8", "up"),
array("Hyundai Kia Automotive Group", "109.8", "up"),
array("IBM", "95.8", "none"),
array("ING Group", "197.9", "down"),
array("Indian Oil Corporation", "52.6", "down"),
array("JPMorgan Chase", "116.4", "up"),
array("Johnson & Johnson", "61.1", "none"),
array("Koch Industries", "98.0", "up"),
array("Kroger", "69.7", "up"),
array("Kuwait Petroleum Corporation", "59.4", "up"),
array("LG Group", "104.3", "none"),
array("LUKoil", "54.1", "none"),
array("Legal & General", "41.0", "up"),
array("Lloyds TSB", "58.7", "up"),
array("Lockheed Martin", "41.9", "none"),
array("Lowe's", "48.3", "none"),
array("Marathon Oil", "57.7", "none"),
array("Matsushita Electric Industrial", "77.2", "down"),
array("McKesson Corporation", "93.0", "up"),
array("Medco Health Solutions", "44.5", "up"),
array("MetLife", "53.0", "up"),
array("Metro AG", "79.0", "up"),
array("Microsoft", "57.9", "none"),
array("Mitsubishi Corporation", "43.3", "down"),
array("Mitsubishi UFJ Financial Group", "49.5", "down"),
array("Mitsui & Co.", "41.5", "down"),
array("Morgan Stanley", "85.3", "down"),
array("Munich Re", "69.7", "up"),
array("National Iranian Oil Company", "45.0", "none"),
array("National Iranian Oil Company", "90.8", "down"),
array("Nestlé", "95.5", "up"),
array("Nippon Oil", "47.6", "down"),
array("Nippon Telegraph and Telephone", "91.6", "up"),
array("Nissan Motors", "108.2", "down"),
array("Nokia", "75.2", "up"),
array("Novartis", "40.2", "up"),
array("Oracle Corporation", "43.8", "none"),
array("PSA Peugeot Citroën", "74.7", "none"),
array("PTT Public Company Limited", "50.1", "down"),
array("Pemex", "104.5", "up"),
array("PetroChina", "88.2", "up"),
array("Petrobras", "208.3", "up"),
array("Petronas", "55.7", "down"),
array("Petróleos de Venezuela", "96.2", "up"),
array("Pfizer", "48.4", "down"),
array("Procter & Gamble", "79.7", "down"),
array("Prudential", "70.3", "up"),
array("RWE", "62.6", "none"),
array("Renault", "59.9", "up"),
array("Repsol YPF", "61.8", "none"),
array("Royal Bank of Canada", "43.6", "down"),
array("Royal Bank of Scotland", "108.5", "up"),
array("Royal Dutch Shell", "355.8", "up"),
array("SK Group", "88.0", "down"),
array("Safeway Inc.", "42.3", "none"),
array("Saint-Gobain", "54.9", "none"),
array("Samsung Group", "174.2", "down"),
array("Sanofi-Aventis", "41.0", "down"),
array("Saudi Aramco", "199.8", "up"),
array("Sears Holdings Corporation", "50.7", "none"),
array("Seven & I Holdings Co.", "45.1", "up"),
array("Siemens AG", "102.7", "down"),
array("Sinopec", "165.4", "up"),
array("Société Générale", "103.5", "up"),
array("Sojitz", "44.4", "down"),
array("Sony", "70.3", "down"),
array("Sprint Nextel Corporation", "40.1", "down"),
array("State Farm Insurance", "61.6", "none"),
array("StatoilHydro", "96.4", "up"),
array("Suez", "65.0", "down"),
array("Sunoco", "41.8", "down"),
array("SuperValu", "44.0", "down"),
array("TATA Group", "72.5", "down"),
array("Target Corporation", "63.4", "up"),
array("Telecom Italia", "42.8", "down"),
array("Telefónica", "82.4", "down"),
array("Tesco", "83.6", "down"),
array("ThyssenKrupp", "73.7", "down"),
array("Time Warner", "46.5", "up"),
array("Tokyo Electric Power", "45.0", "up"),
array("Toshiba", "60.6", "down"),
array("Total S.A.", "217.6", "up"),
array("Toyota Motor Corporation", "264.8", "up"),
array("Toyota Tsusho", "52.9", "down"),
array("UBS AG", "117.0", "up"),
array("UniCredit", "63.7", "up"),
array("Unilever", "54.8", "down"),
array("United Parcel Service", "49.7", "down"),
array("United States Postal Service", "74.8", "up"),
array("United Technologies", "54.8", "down"),
array("UnitedHealth Group Incorporated", "75.4", "up"),
array("VINCI", "44.8", "down"),
array("Valero Energy", "95.3", "up"),
array("Veolia Environnement", "48.0", "none"),
array("Verizon", "93.5", "none"),
array("Vodafone", "61.2", "down"),
array("Volkswagen Group", "160.3", "down"),
array("Volvo", "44.2", "down"),
array("WPP Group", "63.5", "down"),
array("Wal-Mart", "374.5", "up"),
array("Walgreen", "55.1", "up"),
array("WellPoint", "61.1", "up"),
array("Wells Fargo", "53.6", "none"),
array("ZEN-NOH", "63.5", "none"),
array("Zenkyoren or JA Kyosai", "46.8", "down"),
array("Zurich Financial Services", "55.1", "down"),
);
$json = array();
$i = 0;
foreach ($data as $d) {
list($company, $price, $change) = $d;
// when filtering params sent, do filtering
if (isset($_REQUEST["company"])) {
if (!preg_match("/^$_REQUEST[company]/i", $company)) {
continue;
}
if ($_REQUEST["price"] > $price) {
continue;
}
if (!preg_match("/^$_REQUEST[change]/i", $change)) {
continue;
}
}
// when limit sent, show only first n results
$i++;
if (isset($_REQUEST["limit"]) && $i > $_REQUEST["limit"]) {
break;
}
$json[]= array(
"company" => $company,
"price" => $price,
"change" => $change,
);
}
echo json_encode(array("rows" => $json));
?>