@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class OptimizationType |
6 | 6 | { |
7 | - const DISTANCE = 'Distance'; |
|
8 | - const TIME = 'Time'; |
|
9 | - const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
7 | + const DISTANCE = 'Distance'; |
|
8 | + const TIME = 'Time'; |
|
9 | + const TIME_WITH_TRAFFIC = 'timeWithTraffic'; |
|
10 | 10 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class OptimizationStates |
6 | 6 | { |
7 | - const INITIAL = 1; |
|
8 | - const MATRIX_PROCESSING = 2; |
|
9 | - const OPTIMIZING = 3; |
|
10 | - const OPTIMIZED = 4; |
|
11 | - const ERROR = 5; |
|
12 | - const COMPUTING_DIRECTIONS = 6; |
|
7 | + const INITIAL = 1; |
|
8 | + const MATRIX_PROCESSING = 2; |
|
9 | + const OPTIMIZING = 3; |
|
10 | + const OPTIMIZED = 4; |
|
11 | + const ERROR = 5; |
|
12 | + const COMPUTING_DIRECTIONS = 6; |
|
13 | 13 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class Metric |
6 | 6 | { |
7 | - const EUCLIDEAN = 1; |
|
8 | - const MANHATTAN = 2; |
|
9 | - const GEODESIC = 3; |
|
10 | - const MATRIX = 4; |
|
11 | - const EXACT_2D = 5; |
|
7 | + const EUCLIDEAN = 1; |
|
8 | + const MANHATTAN = 2; |
|
9 | + const GEODESIC = 3; |
|
10 | + const MATRIX = 4; |
|
11 | + const EXACT_2D = 5; |
|
12 | 12 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | class DistanceUnit |
6 | 6 | { |
7 | - const MILES = 'mi'; |
|
8 | - const KILOMETERS = 'km'; |
|
7 | + const MILES = 'mi'; |
|
8 | + const KILOMETERS = 'km'; |
|
9 | 9 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | class TerritoryTypes |
6 | 6 | { |
7 | - const CIRCLE = 'circle'; |
|
8 | - const POLY = 'poly'; |
|
9 | - const RECT = 'rect'; |
|
7 | + const CIRCLE = 'circle'; |
|
8 | + const POLY = 'poly'; |
|
9 | + const RECT = 'rect'; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | ?> |
13 | 13 | \ No newline at end of file |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | class Format |
6 | 6 | { |
7 | - const SERIALIZED = 'serialized'; |
|
8 | - const CSV = 'csv'; |
|
9 | - const XML = 'xml'; |
|
10 | - const JSON = 'json'; |
|
7 | + const SERIALIZED = 'serialized'; |
|
8 | + const CSV = 'csv'; |
|
9 | + const XML = 'xml'; |
|
10 | + const JSON = 'json'; |
|
11 | 11 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class TravelMode |
6 | 6 | { |
7 | - const DRIVING = 'Driving'; |
|
8 | - const WALKING = 'Walking'; |
|
9 | - const TRUCKING = 'Trucking'; |
|
7 | + const DRIVING = 'Driving'; |
|
8 | + const WALKING = 'Walking'; |
|
9 | + const TRUCKING = 'Trucking'; |
|
10 | 10 | } |
@@ -4,11 +4,11 @@ |
||
4 | 4 | |
5 | 5 | class AlgorithmType |
6 | 6 | { |
7 | - const TSP = 1; |
|
8 | - const VRP = 2; |
|
9 | - const CVRP_TW_SD = 3; |
|
10 | - const CVRP_TW_MD = 4; |
|
11 | - const TSP_TW = 5; |
|
12 | - const TSP_TW_CR = 6; |
|
13 | - const BBCVRP = 7; |
|
7 | + const TSP = 1; |
|
8 | + const VRP = 2; |
|
9 | + const CVRP_TW_SD = 3; |
|
10 | + const CVRP_TW_MD = 4; |
|
11 | + const TSP_TW = 5; |
|
12 | + const TSP_TW_CR = 6; |
|
13 | + const BBCVRP = 7; |
|
14 | 14 | } |
@@ -6,74 +6,74 @@ discard block |
||
6 | 6 | |
7 | 7 | class Route4Me |
8 | 8 | { |
9 | - static public $apiKey; |
|
10 | - static public $baseUrl = 'https://route4me.com'; |
|
9 | + static public $apiKey; |
|
10 | + static public $baseUrl = 'https://route4me.com'; |
|
11 | 11 | |
12 | - public static function setApiKey($apiKey) |
|
13 | - { |
|
14 | - self::$apiKey = $apiKey; |
|
15 | - } |
|
12 | + public static function setApiKey($apiKey) |
|
13 | + { |
|
14 | + self::$apiKey = $apiKey; |
|
15 | + } |
|
16 | 16 | |
17 | - public static function getApiKey() |
|
18 | - { |
|
19 | - return self::$apiKey; |
|
20 | - } |
|
17 | + public static function getApiKey() |
|
18 | + { |
|
19 | + return self::$apiKey; |
|
20 | + } |
|
21 | 21 | |
22 | - public static function setBaseUrl($baseUrl) |
|
23 | - { |
|
24 | - self::$baseUrl = $baseUrl; |
|
25 | - } |
|
22 | + public static function setBaseUrl($baseUrl) |
|
23 | + { |
|
24 | + self::$baseUrl = $baseUrl; |
|
25 | + } |
|
26 | 26 | |
27 | - public static function getBaseUrl() |
|
28 | - { |
|
29 | - return self::$baseUrl; |
|
30 | - } |
|
27 | + public static function getBaseUrl() |
|
28 | + { |
|
29 | + return self::$baseUrl; |
|
30 | + } |
|
31 | 31 | |
32 | - public static function makeRequst($options) { |
|
33 | - $method = isset($options['method']) ? $options['method'] : 'GET'; |
|
34 | - $query = isset($options['query']) ? |
|
35 | - array_filter($options['query']) : array(); |
|
36 | - $body = isset($options['body']) ? |
|
37 | - array_filter($options['body']) : null; |
|
32 | + public static function makeRequst($options) { |
|
33 | + $method = isset($options['method']) ? $options['method'] : 'GET'; |
|
34 | + $query = isset($options['query']) ? |
|
35 | + array_filter($options['query']) : array(); |
|
36 | + $body = isset($options['body']) ? |
|
37 | + array_filter($options['body']) : null; |
|
38 | 38 | $httpHeader = isset($options['HTTPHEADER']) ? $options['HTTPHEADER'] : null; |
39 | 39 | |
40 | - $ch = curl_init(); |
|
41 | - $url = $options['url'] . '?' . http_build_query(array_merge( |
|
42 | - $query, array( 'api_key' => self::getApiKey()) |
|
43 | - )); |
|
40 | + $ch = curl_init(); |
|
41 | + $url = $options['url'] . '?' . http_build_query(array_merge( |
|
42 | + $query, array( 'api_key' => self::getApiKey()) |
|
43 | + )); |
|
44 | 44 | |
45 | 45 | //$jfile=json_encode($body); echo $jfile; die(""); |
46 | 46 | $baseUrl=self::getBaseUrl(); |
47 | 47 | |
48 | 48 | if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com'; |
49 | - $curlOpts = arraY( |
|
50 | - CURLOPT_URL => $baseUrl. $url, |
|
51 | - CURLOPT_RETURNTRANSFER => true, |
|
52 | - CURLOPT_TIMEOUT => 60, |
|
53 | - CURLOPT_FOLLOWLOCATION => true, |
|
54 | - CURLOPT_SSL_VERIFYHOST => FALSE, |
|
55 | - CURLOPT_SSL_VERIFYPEER => FALSE, |
|
56 | - CURLOPT_HTTPHEADER => array( |
|
57 | - 'User-Agent' => 'Route4Me php-sdk' |
|
58 | - ) |
|
59 | - ); |
|
49 | + $curlOpts = arraY( |
|
50 | + CURLOPT_URL => $baseUrl. $url, |
|
51 | + CURLOPT_RETURNTRANSFER => true, |
|
52 | + CURLOPT_TIMEOUT => 60, |
|
53 | + CURLOPT_FOLLOWLOCATION => true, |
|
54 | + CURLOPT_SSL_VERIFYHOST => FALSE, |
|
55 | + CURLOPT_SSL_VERIFYPEER => FALSE, |
|
56 | + CURLOPT_HTTPHEADER => array( |
|
57 | + 'User-Agent' => 'Route4Me php-sdk' |
|
58 | + ) |
|
59 | + ); |
|
60 | 60 | //echo "url=".$baseUrl.$url."<br>";die(""); |
61 | - curl_setopt_array($ch, $curlOpts); |
|
62 | - switch($method) { |
|
63 | - case 'DELETE': |
|
64 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
61 | + curl_setopt_array($ch, $curlOpts); |
|
62 | + switch($method) { |
|
63 | + case 'DELETE': |
|
64 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
65 | 65 | |
66 | 66 | if (isset($body)) { |
67 | 67 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
68 | 68 | } |
69 | - break; |
|
69 | + break; |
|
70 | 70 | case 'DELETEARRAY': |
71 | 71 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
72 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
73 | - break; |
|
74 | - case 'PUT': |
|
72 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
73 | + break; |
|
74 | + case 'PUT': |
|
75 | 75 | //$jfile=json_encode($body); echo $jfile; die(""); |
76 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
76 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
77 | 77 | if (isset($query)) { |
78 | 78 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
79 | 79 | } |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
83 | 83 | } |
84 | 84 | break; |
85 | - case 'POST': |
|
85 | + case 'POST': |
|
86 | 86 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
87 | 87 | if (isset($query)) { |
88 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
88 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | if (isset($body)) { |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | } |
94 | 94 | break; |
95 | 95 | case 'ADD': |
96 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
97 | - } |
|
96 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
97 | + } |
|
98 | 98 | |
99 | 99 | if ($httpHeader!=null) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader); |
100 | 100 | |
101 | - $result = curl_exec($ch); |
|
101 | + $result = curl_exec($ch); |
|
102 | 102 | //var_dump($result); die(""); |
103 | 103 | $isxml=FALSE; |
104 | 104 | $jxml=""; |
@@ -109,58 +109,58 @@ discard block |
||
109 | 109 | $isxml = TRUE; |
110 | 110 | } |
111 | 111 | |
112 | - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
113 | - curl_close($ch); |
|
112 | + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
113 | + curl_close($ch); |
|
114 | 114 | |
115 | 115 | if ($isxml) { |
116 | 116 | $json = $jxml; |
117 | 117 | } else $json = json_decode($result, true); |
118 | 118 | //var_dump($json); die(""); |
119 | - if (200 == $code) { |
|
120 | - return $json; |
|
121 | - } elseif (isset($json['errors'])) { |
|
122 | - throw new ApiError(implode(', ', $json['errors'])); |
|
123 | - } else { |
|
124 | - throw new ApiError('Something wrong'); |
|
125 | - } |
|
126 | - } |
|
119 | + if (200 == $code) { |
|
120 | + return $json; |
|
121 | + } elseif (isset($json['errors'])) { |
|
122 | + throw new ApiError(implode(', ', $json['errors'])); |
|
123 | + } else { |
|
124 | + throw new ApiError('Something wrong'); |
|
125 | + } |
|
126 | + } |
|
127 | 127 | |
128 | 128 | public static function makeUrlRequst($url, $options) { |
129 | 129 | $method = isset($options['method']) ? $options['method'] : 'GET'; |
130 | - $query = isset($options['query']) ? |
|
131 | - array_filter($options['query']) : array(); |
|
132 | - $body = isset($options['body']) ? |
|
133 | - array_filter($options['body']) : null; |
|
134 | - $ch = curl_init(); |
|
130 | + $query = isset($options['query']) ? |
|
131 | + array_filter($options['query']) : array(); |
|
132 | + $body = isset($options['body']) ? |
|
133 | + array_filter($options['body']) : null; |
|
134 | + $ch = curl_init(); |
|
135 | 135 | |
136 | 136 | $curlOpts = arraY( |
137 | - CURLOPT_URL => $url, |
|
138 | - CURLOPT_RETURNTRANSFER => true, |
|
139 | - CURLOPT_TIMEOUT => 60, |
|
140 | - CURLOPT_FOLLOWLOCATION => true, |
|
141 | - CURLOPT_SSL_VERIFYHOST => FALSE, |
|
142 | - CURLOPT_SSL_VERIFYPEER => FALSE, |
|
143 | - CURLOPT_HTTPHEADER => array( |
|
144 | - 'User-Agent' => 'Route4Me php-sdk' |
|
145 | - ) |
|
146 | - ); |
|
137 | + CURLOPT_URL => $url, |
|
138 | + CURLOPT_RETURNTRANSFER => true, |
|
139 | + CURLOPT_TIMEOUT => 60, |
|
140 | + CURLOPT_FOLLOWLOCATION => true, |
|
141 | + CURLOPT_SSL_VERIFYHOST => FALSE, |
|
142 | + CURLOPT_SSL_VERIFYPEER => FALSE, |
|
143 | + CURLOPT_HTTPHEADER => array( |
|
144 | + 'User-Agent' => 'Route4Me php-sdk' |
|
145 | + ) |
|
146 | + ); |
|
147 | 147 | |
148 | 148 | curl_setopt_array($ch, $curlOpts); |
149 | 149 | |
150 | - switch($method) { |
|
151 | - case 'DELETE': |
|
152 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
150 | + switch($method) { |
|
151 | + case 'DELETE': |
|
152 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
|
153 | 153 | |
154 | 154 | if (isset($body)) { |
155 | 155 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
156 | 156 | } |
157 | - break; |
|
157 | + break; |
|
158 | 158 | case 'DELETEARRAY': |
159 | 159 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
160 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
161 | - break; |
|
162 | - case 'PUT': |
|
163 | - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
160 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
161 | + break; |
|
162 | + case 'PUT': |
|
163 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); |
|
164 | 164 | if (isset($query)) { |
165 | 165 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
166 | 166 | } |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body)); |
170 | 170 | } |
171 | 171 | break; |
172 | - case 'POST': |
|
172 | + case 'POST': |
|
173 | 173 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
174 | 174 | if (isset($query)) { |
175 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
175 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | if (isset($body)) { |
@@ -180,8 +180,8 @@ discard block |
||
180 | 180 | } |
181 | 181 | break; |
182 | 182 | case 'ADD': |
183 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
184 | - } |
|
183 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
|
184 | + } |
|
185 | 185 | |
186 | 186 | $result = curl_exec($ch); |
187 | 187 | $isxml=FALSE; |
@@ -193,20 +193,20 @@ discard block |
||
193 | 193 | $isxml = TRUE; |
194 | 194 | } |
195 | 195 | |
196 | - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
197 | - curl_close($ch); |
|
196 | + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
|
197 | + curl_close($ch); |
|
198 | 198 | |
199 | 199 | if ($isxml) { |
200 | 200 | $json = $jxml; |
201 | 201 | } else $json = json_decode($result, true); |
202 | 202 | |
203 | - if (200 == $code) { |
|
204 | - return $json; |
|
205 | - } elseif (isset($json['errors'])) { |
|
206 | - throw new ApiError(implode(', ', $json['errors'])); |
|
207 | - } else { |
|
208 | - throw new ApiError('Something wrong'); |
|
209 | - } |
|
203 | + if (200 == $code) { |
|
204 | + return $json; |
|
205 | + } elseif (isset($json['errors'])) { |
|
206 | + throw new ApiError(implode(', ', $json['errors'])); |
|
207 | + } else { |
|
208 | + throw new ApiError('Something wrong'); |
|
209 | + } |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | $httpHeader = isset($options['HTTPHEADER']) ? $options['HTTPHEADER'] : null; |
39 | 39 | |
40 | 40 | $ch = curl_init(); |
41 | - $url = $options['url'] . '?' . http_build_query(array_merge( |
|
42 | - $query, array( 'api_key' => self::getApiKey()) |
|
41 | + $url = $options['url'].'?'.http_build_query(array_merge( |
|
42 | + $query, array('api_key' => self::getApiKey()) |
|
43 | 43 | )); |
44 | 44 | |
45 | 45 | //$jfile=json_encode($body); echo $jfile; die(""); |
46 | - $baseUrl=self::getBaseUrl(); |
|
46 | + $baseUrl = self::getBaseUrl(); |
|
47 | 47 | |
48 | - if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com'; |
|
48 | + if (strpos($url, 'move_route_destination')>0) $baseUrl = 'https://www.route4me.com'; |
|
49 | 49 | $curlOpts = arraY( |
50 | - CURLOPT_URL => $baseUrl. $url, |
|
50 | + CURLOPT_URL => $baseUrl.$url, |
|
51 | 51 | CURLOPT_RETURNTRANSFER => true, |
52 | 52 | CURLOPT_TIMEOUT => 60, |
53 | 53 | CURLOPT_FOLLOWLOCATION => true, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ); |
60 | 60 | //echo "url=".$baseUrl.$url."<br>";die(""); |
61 | 61 | curl_setopt_array($ch, $curlOpts); |
62 | - switch($method) { |
|
62 | + switch ($method) { |
|
63 | 63 | case 'DELETE': |
64 | 64 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
65 | 65 | |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | |
101 | 101 | $result = curl_exec($ch); |
102 | 102 | //var_dump($result); die(""); |
103 | - $isxml=FALSE; |
|
104 | - $jxml=""; |
|
103 | + $isxml = FALSE; |
|
104 | + $jxml = ""; |
|
105 | 105 | if (strpos($result, '<?xml')>-1) |
106 | 106 | { |
107 | 107 | $xml = simplexml_load_string($result); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $json = $jxml; |
117 | 117 | } else $json = json_decode($result, true); |
118 | 118 | //var_dump($json); die(""); |
119 | - if (200 == $code) { |
|
119 | + if (200==$code) { |
|
120 | 120 | return $json; |
121 | 121 | } elseif (isset($json['errors'])) { |
122 | 122 | throw new ApiError(implode(', ', $json['errors'])); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | curl_setopt_array($ch, $curlOpts); |
149 | 149 | |
150 | - switch($method) { |
|
150 | + switch ($method) { |
|
151 | 151 | case 'DELETE': |
152 | 152 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
153 | 153 | |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | $result = curl_exec($ch); |
187 | - $isxml=FALSE; |
|
188 | - $jxml=""; |
|
187 | + $isxml = FALSE; |
|
188 | + $jxml = ""; |
|
189 | 189 | if (strpos($result, '<?xml')>-1) |
190 | 190 | { |
191 | 191 | $xml = simplexml_load_string($result); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $json = $jxml; |
201 | 201 | } else $json = json_decode($result, true); |
202 | 202 | |
203 | - if (200 == $code) { |
|
203 | + if (200==$code) { |
|
204 | 204 | return $json; |
205 | 205 | } elseif (isset($json['errors'])) { |
206 | 206 | throw new ApiError(implode(', ', $json['errors'])); |
@@ -45,7 +45,9 @@ discard block |
||
45 | 45 | //$jfile=json_encode($body); echo $jfile; die(""); |
46 | 46 | $baseUrl=self::getBaseUrl(); |
47 | 47 | |
48 | - if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com'; |
|
48 | + if (strpos($url,'move_route_destination')>0) { |
|
49 | + $baseUrl='https://www.route4me.com'; |
|
50 | + } |
|
49 | 51 | $curlOpts = arraY( |
50 | 52 | CURLOPT_URL => $baseUrl. $url, |
51 | 53 | CURLOPT_RETURNTRANSFER => true, |
@@ -96,7 +98,9 @@ discard block |
||
96 | 98 | curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); break; |
97 | 99 | } |
98 | 100 | |
99 | - if ($httpHeader!=null) curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader); |
|
101 | + if ($httpHeader!=null) { |
|
102 | + curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeader); |
|
103 | + } |
|
100 | 104 | |
101 | 105 | $result = curl_exec($ch); |
102 | 106 | //var_dump($result); die(""); |
@@ -114,7 +118,9 @@ discard block |
||
114 | 118 | |
115 | 119 | if ($isxml) { |
116 | 120 | $json = $jxml; |
117 | - } else $json = json_decode($result, true); |
|
121 | + } else { |
|
122 | + $json = json_decode($result, true); |
|
123 | + } |
|
118 | 124 | //var_dump($json); die(""); |
119 | 125 | if (200 == $code) { |
120 | 126 | return $json; |
@@ -198,7 +204,9 @@ discard block |
||
198 | 204 | |
199 | 205 | if ($isxml) { |
200 | 206 | $json = $jxml; |
201 | - } else $json = json_decode($result, true); |
|
207 | + } else { |
|
208 | + $json = json_decode($result, true); |
|
209 | + } |
|
202 | 210 | |
203 | 211 | if (200 == $code) { |
204 | 212 | return $json; |