@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $rpath = realpath($fname); |
| 45 | 45 | |
| 46 | - $fp=fopen(realpath($fname),"r"); |
|
| 46 | + $fp = fopen(realpath($fname), "r"); |
|
| 47 | 47 | |
| 48 | - $url = self::$baseUrl.$options['url'] . '?' . http_build_query(array_merge( |
|
| 49 | - array( 'api_key' => self::getApiKey()), $query) |
|
| 48 | + $url = self::$baseUrl.$options['url'].'?'.http_build_query(array_merge( |
|
| 49 | + array('api_key' => self::getApiKey()), $query) |
|
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | 52 | //self::simplePrint($body);die(""); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | //echo "code = $code <br>"; |
| 81 | 81 | $json = json_decode($result, true); |
| 82 | 82 | //var_dump($json); die(""); |
| 83 | - if (200 == $code) { |
|
| 83 | + if (200==$code) { |
|
| 84 | 84 | return $json; |
| 85 | 85 | } elseif (isset($json['errors'])) { |
| 86 | 86 | throw new ApiError(implode(', ', $json['errors'])); |
@@ -102,26 +102,26 @@ discard block |
||
| 102 | 102 | ); |
| 103 | 103 | |
| 104 | 104 | if (isset($options['HTTPHEADER'])) { |
| 105 | - $headers[]=$options['HTTPHEADER']; |
|
| 105 | + $headers[] = $options['HTTPHEADER']; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if (isset($options['HTTPHEADERS'])) { |
| 109 | - foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header; |
|
| 109 | + foreach ($options['HTTPHEADERS'] As $header) $headers[] = $header; |
|
| 110 | 110 | } |
| 111 | 111 | //self::simplePrint($headers); die(""); |
| 112 | 112 | $ch = curl_init(); |
| 113 | - $url = $options['url'] . '?' . http_build_query(array_merge( |
|
| 114 | - $query, array( 'api_key' => self::getApiKey()) |
|
| 113 | + $url = $options['url'].'?'.http_build_query(array_merge( |
|
| 114 | + $query, array('api_key' => self::getApiKey()) |
|
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | //$jfile=json_encode($body); echo $jfile; die(""); |
| 118 | 118 | |
| 119 | 119 | //self::simplePrint($headers); die(""); |
| 120 | - $baseUrl=self::getBaseUrl(); |
|
| 120 | + $baseUrl = self::getBaseUrl(); |
|
| 121 | 121 | |
| 122 | - if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com'; |
|
| 122 | + if (strpos($url, 'move_route_destination')>0) $baseUrl = 'https://www.route4me.com'; |
|
| 123 | 123 | $curlOpts = arraY( |
| 124 | - CURLOPT_URL => $baseUrl. $url, |
|
| 124 | + CURLOPT_URL => $baseUrl.$url, |
|
| 125 | 125 | CURLOPT_RETURNTRANSFER => true, |
| 126 | 126 | CURLOPT_TIMEOUT => 60, |
| 127 | 127 | CURLOPT_FOLLOWLOCATION => true, |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | //echo "url=".$baseUrl.$url."<br>";die(""); |
| 134 | 134 | curl_setopt_array($ch, $curlOpts); |
| 135 | 135 | |
| 136 | - if ($file !=null) { |
|
| 136 | + if ($file!=null) { |
|
| 137 | 137 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
| 138 | - $fp=fopen($file,'r'); |
|
| 139 | - curl_setopt($ch, CURLOPT_INFILE , $fp); |
|
| 138 | + $fp = fopen($file, 'r'); |
|
| 139 | + curl_setopt($ch, CURLOPT_INFILE, $fp); |
|
| 140 | 140 | curl_setopt($ch, CURLOPT_INFILESIZE, filesize($file)); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - switch($method) { |
|
| 143 | + switch ($method) { |
|
| 144 | 144 | case 'DELETE': |
| 145 | 145 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
| 146 | 146 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | break; |
| 166 | 166 | case 'POST': |
| 167 | 167 | if (isset($query)) { |
| 168 | - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 168 | + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($query)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | //echo json_encode($body); die(""); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $result = curl_exec($ch); |
| 181 | 181 | //var_dump($result); die(""); |
| 182 | - $isxml=FALSE; |
|
| 183 | - $jxml=""; |
|
| 182 | + $isxml = FALSE; |
|
| 183 | + $jxml = ""; |
|
| 184 | 184 | if (strpos($result, '<?xml')>-1) |
| 185 | 185 | { |
| 186 | 186 | $xml = simplexml_load_string($result); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $json = $jxml; |
| 196 | 196 | } else $json = json_decode($result, true); |
| 197 | 197 | //var_dump($json); die(""); |
| 198 | - if (200 == $code) { |
|
| 198 | + if (200==$code) { |
|
| 199 | 199 | return $json; |
| 200 | 200 | } elseif (isset($json['errors'])) { |
| 201 | 201 | throw new ApiError(implode(', ', $json['errors'])); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | curl_setopt_array($ch, $curlOpts); |
| 228 | 228 | |
| 229 | - switch($method) { |
|
| 229 | + switch ($method) { |
|
| 230 | 230 | case 'DELETE': |
| 231 | 231 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); |
| 232 | 232 | |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | |
| 265 | 265 | $result = curl_exec($ch); |
| 266 | 266 | |
| 267 | - $isxml=FALSE; |
|
| 268 | - $jxml=""; |
|
| 267 | + $isxml = FALSE; |
|
| 268 | + $jxml = ""; |
|
| 269 | 269 | if (strpos($result, '<?xml')>-1) |
| 270 | 270 | { |
| 271 | 271 | $xml = simplexml_load_string($result); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | } else $json = json_decode($result, true); |
| 282 | 282 | |
| 283 | 283 | |
| 284 | - if (200 == $code) { |
|
| 284 | + if (200==$code) { |
|
| 285 | 285 | return $json; |
| 286 | 286 | } elseif (isset($json['errors'])) { |
| 287 | 287 | throw new ApiError(implode(', ', $json['errors'])); |
@@ -33,13 +33,17 @@ discard block |
||
| 33 | 33 | $query = isset($options['query']) ? |
| 34 | 34 | array_filter($options['query']) : array(); |
| 35 | 35 | |
| 36 | - if (sizeof($query)==0) return null; |
|
| 36 | + if (sizeof($query)==0) { |
|
| 37 | + return null; |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | $body = isset($options['body']) ? |
| 39 | 41 | array_filter($options['body']) : null; |
| 40 | 42 | |
| 41 | 43 | $fname = isset($body['strFilename']) ? $body['strFilename'] : ''; |
| 42 | - if ($fname=='') return null; |
|
| 44 | + if ($fname=='') { |
|
| 45 | + return null; |
|
| 46 | + } |
|
| 43 | 47 | |
| 44 | 48 | $rpath = realpath($fname); |
| 45 | 49 | |
@@ -106,7 +110,9 @@ discard block |
||
| 106 | 110 | } |
| 107 | 111 | |
| 108 | 112 | if (isset($options['HTTPHEADERS'])) { |
| 109 | - foreach ($options['HTTPHEADERS'] As $header) $headers[]=$header; |
|
| 113 | + foreach ($options['HTTPHEADERS'] As $header) { |
|
| 114 | + $headers[]=$header; |
|
| 115 | + } |
|
| 110 | 116 | } |
| 111 | 117 | //self::simplePrint($headers); die(""); |
| 112 | 118 | $ch = curl_init(); |
@@ -119,7 +125,9 @@ discard block |
||
| 119 | 125 | //self::simplePrint($headers); die(""); |
| 120 | 126 | $baseUrl=self::getBaseUrl(); |
| 121 | 127 | |
| 122 | - if (strpos($url,'move_route_destination')>0) $baseUrl='https://www.route4me.com'; |
|
| 128 | + if (strpos($url,'move_route_destination')>0) { |
|
| 129 | + $baseUrl='https://www.route4me.com'; |
|
| 130 | + } |
|
| 123 | 131 | $curlOpts = arraY( |
| 124 | 132 | CURLOPT_URL => $baseUrl. $url, |
| 125 | 133 | CURLOPT_RETURNTRANSFER => true, |
@@ -193,7 +201,9 @@ discard block |
||
| 193 | 201 | |
| 194 | 202 | if ($isxml) { |
| 195 | 203 | $json = $jxml; |
| 196 | - } else $json = json_decode($result, true); |
|
| 204 | + } else { |
|
| 205 | + $json = json_decode($result, true); |
|
| 206 | + } |
|
| 197 | 207 | //var_dump($json); die(""); |
| 198 | 208 | if (200 == $code) { |
| 199 | 209 | return $json; |
@@ -278,7 +288,9 @@ discard block |
||
| 278 | 288 | |
| 279 | 289 | if ($isxml) { |
| 280 | 290 | $json = $jxml; |
| 281 | - } else $json = json_decode($result, true); |
|
| 291 | + } else { |
|
| 292 | + $json = json_decode($result, true); |
|
| 293 | + } |
|
| 282 | 294 | |
| 283 | 295 | |
| 284 | 296 | if (200 == $code) { |