add fulcrm_apiv2_make_url() function; trim pointless cURL code

master
Marek Isalski 9 years ago
parent 9f167bccfd
commit 48ce4c8c82

@ -61,6 +61,15 @@ function fulcrm_apiv2_url_is_type( $url, $type ) {
return false; 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 ) { function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null ) {
$url = null; $url = null;
@ -104,7 +113,6 @@ function fulcrm_apiv2_http( $method, $object = null, $data = null, $query = null
$request_headers[] = 'Content-Type: application/json'; $request_headers[] = 'Content-Type: application/json';
} }
curl_setopt( $curl, CURLOPT_POSTFIELDS, $data ); curl_setopt( $curl, CURLOPT_POSTFIELDS, $data );
$request_headers[] = 'Content-Length: ' . strlen( $data );
} }
$incoming_client_ids = &drupal_static( 'fulcrm_apiv2_prevent_loop' ); $incoming_client_ids = &drupal_static( 'fulcrm_apiv2_prevent_loop' );

Loading…
Cancel
Save