Active
Project:
Web service client
Version:
7.x-1.0
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Mar 2014 at 06:20 UTC
Updated:
30 Mar 2014 at 06:20 UTC
I have a web service for uploading a file. In PHP this service can be called like this:
$url = $base_url . '/api/import';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
'file' => '@'.dirname(__FILE__).'/filename',
));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: multipart/form-data',
'Authorization: Bearer ' . $access_token,
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
In Drupal I would like to use wsclient, since I am using it for the rest of the service calls. But I don't see how this can be done.
Is there any way to do this with wsclient, or I should just use drupal_http_request()?