prepareData = $this->prepareRequest($request); if($header == self::CONTENT_TYPE_X_WWW_FORM_URLENCODE) { $response = Http::asForm(); }else if($header == self::CONTENT_TYPE_JSON){ $response = Http::asJson(); } $response = $response->post( static::$url, $this->prepareData ); return json_decode((string) $response->getBody(), true); } public function get($request, $header = 'application/x-www-form-urlencoded'){ $this->prepareData = $this->prepareRequest($request); if($header == self::CONTENT_TYPE_X_WWW_FORM_URLENCODE) { $response = Http::asForm(); }else if($header == self::CONTENT_TYPE_JSON){ $response = Http::asJson(); } $response = $response->get( static::$url, $this->prepareData ); return json_decode((string) $response->getBody(), true); } public function put($request, $header = 'application/x-www-form-urlencoded'){ $this->prepareData = $this->prepareRequest($request); if($header == self::CONTENT_TYPE_X_WWW_FORM_URLENCODE) { $response = Http::asForm(); }else if($header == self::CONTENT_TYPE_JSON){ $response = Http::asJson(); } $response = $response->put( static::$url, $this->prepareData ); return json_decode((string) $response->getBody(), true); } }