1: <?php
2:
3: namespace predictionio;
4:
5: /**
6: * Client for connecting to an Engine Instance
7: *
8: */
9: class EngineClient extends BaseClient {
10:
11: /**
12: * @param string Base URL to the Engine Instance. Default is localhost:8000.
13: * @param float Timeout of the request in seconds. Use 0 to wait indefinitely
14: * Default is 0.
15: * @param float Number of seconds to wait while trying to connect to a server.
16: * Default is 5.
17: */
18: public function __construct($baseUrl="http://localhost:8000",
19: $timeout=0, $connectTimeout=5 ) {
20: parent::__construct($baseUrl, $timeout, $connectTimeout);
21: }
22:
23: /**
24: * Send prediction query to an Engine Instance
25: *
26: * @param array Query
27: *
28: * @return array JSON response
29: *
30: * @throws PredictionIOAPIError Request error
31: */
32: public function sendQuery(array $query) {
33: return $this->sendRequest("POST", "/queries.json", json_encode($query));
34: }
35: }
36:
37: ?>
38: