| 683 |
if (variable_get('ipaper_log_requests', 0) && $params){ |
if (variable_get('ipaper_log_requests', 0) && $params){ |
| 684 |
$APImethod = $params['method']; |
$APImethod = $params['method']; |
| 685 |
$doc_id = $params['doc_id'] ? $params['doc_id'] : $params['doc_ids']; |
$doc_id = $params['doc_id'] ? $params['doc_id'] : $params['doc_ids']; |
| 686 |
watchdog('ipaper', "Action: $APImethod, Document ID: $doc_id", NULL, WATCHDOG_NOTICE, $request_url . http_build_query($params)); |
watchdog('ipaper', "Action: $APImethod, Document ID: $doc_id", WATCHDOG_NOTICE, $request_url . http_build_query($params)); |
| 687 |
} |
} |
| 688 |
|
|
| 689 |
if (function_exists("curl_init")){ |
if (function_exists("curl_init")){ |
| 699 |
return $data; |
return $data; |
| 700 |
} |
} |
| 701 |
else{ |
else{ |
|
|
|
|
//I haven't yet figured out how to upload files via drupal_http_request |
|
|
drupal_set_message("CURL is not enabled.", 'error'); |
|
|
return; |
|
|
|
|
|
$data = NULL; |
|
| 702 |
$headers = array(); |
$headers = array(); |
| 703 |
if ($params['file']){ |
$data = NULL; |
| 704 |
$headers = array('Content-Type' => 'multipart/form-data'); |
if ($method == "POST"){ |
| 705 |
|
require_once drupal_get_path('module', 'ipaper') .'/multipart.inc'; |
| 706 |
|
$boundary = 'A0sFSD'; |
| 707 |
|
$headers = array("Content-Type" => "multipart/form-data; boundary=$boundary"); |
| 708 |
|
$data = multipart_encode($boundary, $params); |
| 709 |
} |
} |
| 710 |
$request = drupal_http_request($request_url, $headers, $method, http_build_query($params)); |
$request = drupal_http_request($request_url, $headers, $method, $data); |
| 711 |
if ($request->error) |
if ($request->error) |
| 712 |
watchdog("ipaper", "Request failed - ". $request->error .' - '. http_build_query($params)); |
watchdog("ipaper", "Request failed - ". $request->error .' - '. http_build_query($params)); |
| 713 |
|
drupal_set_message($request->data); |
| 714 |
return $request->data; |
return $request->data; |
| 715 |
} |
} |
| 716 |
|
|