コード例 #1
0
 private function send($method = 'POST', $data = null)
 {
     $method = strtoupper($method);
     // only use JSON for now
     $headers = apply_filters('lift_search_headers', array('Content-Type' => 'application/json', 'Accept' => 'application/json'), $method, $data, $this);
     switch ($method) {
         case 'POST':
             $response = $this->http_interface->post($this->submission_uri, $data, $headers);
             break;
         case 'GET':
             $response = $this->http_interface->get($this->search_uri . $data, $headers);
             break;
         default:
             throw new Exception('you did it wrong');
     }
     $json = json_decode($response);
     if (!$json) {
         $this->error_messages = $response;
     }
     return $json;
 }