From 48ce4c8c8262ac0e979cc7311c3f028270daa775 Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Wed, 23 Mar 2016 11:25:11 +0000 Subject: [PATCH] add fulcrm_apiv2_make_url() function; trim pointless cURL code --- fulcrm_apiv2.module | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fulcrm_apiv2.module b/fulcrm_apiv2.module index 92589cb..0018154 100644 --- a/fulcrm_apiv2.module +++ b/fulcrm_apiv2.module @@ -61,6 +61,15 @@ function fulcrm_apiv2_url_is_type( $url, $type ) { return false; } +function fulcrm_apiv2_make_url( $type, $id = null ) { + $url = 'https://' . variable_get( 'fulcrm_apiv2_hostname', 'fulcrm.org' ) . '/api/v2/' . $type . '/'; + + if ( $id !== null ) + $url .= $id . '/'; + + return $url; +} + function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null ) { $url = null; @@ -104,7 +113,6 @@ function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null $request_headers[] = 'Content-Type: application/json'; } curl_setopt( $curl, CURLOPT_POSTFIELDS, $data ); - $request_headers[] = 'Content-Length: ' . strlen( $data ); } $incoming_client_ids = &drupal_static( 'fulcrm_apiv2_prevent_loop' );