-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchart.php
58 lines (53 loc) · 1.28 KB
/
chart.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
<?php
/**
* proxy of google chart graphviz api
*
* $Id proxy.php tecbbs@qq.com 2015-5-29 $
**/
$api = "https://chart.googleapis.com/chart?";
//$api = "https://chart.googleapis.com/chart?cht=";
$cht = "gv";
$chl = "graph {fontname=\"SimSun\";node{shape=box];a[label=\"nothing to do~\"];}";
$chof = "gif";
function curlGet($url) {
$ch = curl_init();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, FALSE );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, FALSE );
curl_setopt ( $ch, CURLOPT_HEADER, 0 );
// curl_setopt ( $ch, CURLOPT_HTTPHEADER, $header );
$data = curl_exec ($ch);
return $data;
}
$url = $api;
$i = 0;
$sum = count($_GET);
foreach($_GET as $k => $v) {
if($k == "chl" || $k == "chdl") {
$v = urlencode($v);
}
$i++;
if($i<$sum)
$url .= $k . "=" . $v . "&";
else
$url .= $k . "=" . $v;
}
//die($url);
/*
if(isset($_GET['cht'])) {
$cht = $_GET['cht'];
}
if(isset($_GET['chl'])) {
$chl = $_GET['chl'];
}
if(isset($_GET['chof'])) {
$chof = $_GET['chof'];
}
$chl = urlencode($chl);
$url = $api . $cht . "&chl=" . $chl . "&chof=" . $chof;
*/
header("Content-Type: image/webp; charset=UTF-8");
$data = curlGet($url);
die($data);
?>