-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
114 lines (100 loc) · 4.49 KB
/
index.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
<?php
if (isset($_GET['temp'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00010");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00010");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (isset($_GET['height'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00065");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00065");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (isset($_GET['ph'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00400");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00400");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (isset($_GET['salt'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00480");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00480");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (isset($_GET['dis'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00060");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00060");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (isset($_GET['cond'])) {
$string = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000¶meterCd=00095");
$json = json_decode($string, true);
$raw = ($json["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value = str_replace("string(4)", "", $raw);
if($value != -999999) {
echo $value;
} else {
$string2 = file_get_contents("http://waterservices.usgs.gov/nwis/iv/?format=json&sites=07374000&startDT=2013-10-27T05:00&endDT=2013-10-27T05:00¶meterCd=00060");
$json2 = json_decode($string2, true);
$raw2 = ($json2["value"]["timeSeries"][0]["values"][0]["value"][0]["value"]);
$value2 = str_replace("string(4)", "", $raw2);
echo $value2;
}
}
if (empty($_GET)) {
echo "<a href=\"?height\">Height</a><br />";
echo "<a href=\"?temp\">Temperature</a><br />";
echo "<a href=\"?ph\">PH</a><br />";
echo "<a href=\"?salt\">Salinity</a><br />";
echo "<a href=\"?dis\">Discharge</a><br />";
echo "<a href=\"?cond\">Conductance</a><br />";
}
?>