64 $this->consumer = $consumer;
66 $this->mediaType = $mediaType;
78 public function send($method, $parameters = array(), $body =
null)
81 if (!empty($parameters)) {
82 if (strpos($url,
'?') ===
false) {
87 foreach ($parameters as $name => $value) {
88 $url .= $sep . urlencode($name) .
'=' . urlencode($value);
92 if (!$this->
unsigned) {
93 $header = $this->consumer->signServiceRequest($url, $method, $this->mediaType, $body);
99 $this->http =
new HTTPMessage($url, $method, $body, $header);
101 if ($this->http->send() && !empty($this->http->response)) {
102 $this->http->responseJson = json_decode($this->http->response);
103 $this->http->ok = !is_null($this->http->responseJson);
$endpoint
Service endpoint.
$unsigned
Whether service request should be sent unsigned.
Class to implement a service.
__construct($consumer, $endpoint, $mediaType)
Class constructor.
send($method, $parameters=array(), $body=null)
Send a service request.
Class to represent an HTTP message request.
getHTTPMessage()
Get HTTPMessage object for last request.