| 717 |
return $data; |
return $data; |
| 718 |
} |
} |
| 719 |
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; |
|
| 720 |
$headers = array(); |
$headers = array(); |
| 721 |
if ($params['file']){ |
$data = NULL; |
| 722 |
$headers = array('Content-Type' => 'multipart/form-data'); |
if ($method == "POST"){ |
| 723 |
|
require_once drupal_get_path('module', 'ipaper') .'/multipart.inc'; |
| 724 |
|
$boundary = 'A0sFSD'; |
| 725 |
|
$headers = array("Content-Type" => "multipart/form-data; boundary=$boundary"); |
| 726 |
|
$data = multipart_encode($boundary, $params); |
| 727 |
} |
} |
| 728 |
$request = drupal_http_request($request_url, $headers, $method, http_build_query($params)); |
$request = drupal_http_request($request_url, $headers, $method, $data); |
| 729 |
if ($request->error) |
if ($request->error) |
| 730 |
watchdog("ipaper", "Request failed - ". $request->error .' - '. http_build_query($params)); |
watchdog("ipaper", "Request failed - ". $request->error .' - '. http_build_query($params)); |
| 731 |
|
drupal_set_message($request->data); |
| 732 |
return $request->data; |
return $request->data; |
| 733 |
} |
} |
| 734 |
|
|