Add the following rule in your .htaccess file:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
Thank you for the fast reply. now I get the result.
I have another question:
If I want to update a package with the url
https://xxxxx.de/wp-json/wpdm/v1/packages/4070 //I got the package ID by the request before, I get the result “code”:”rest_no_route”, … 404
What can I do?
Thanks
Uli
Thank you for the fast reply. now I get the result.
I have another question:
If I want to update a package with the url
https://MY_DOMAIN/wp-json/wpdm/v1/packages/4070
//I got the package ID by the request before,
I get the result “code”:”rest_no_route”, … 404
What can I do?
Thanks
Uli
-
This reply was modified 2 years, 3 months ago by ulieckardt.
-
This reply was modified 2 years, 3 months ago by ulieckardt.
please add curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
with your php curl option setup
Hi,
perfect, it works 🙂
But how can I change the data of a package?
I’ve tried:
$post[‘password’] = “[123]”;
$jsonData = json_encode($post);
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonData);
—
And I’ve tried
$data = <<<DATA
{
“password”: “The Alchemist”
}
DATA;`
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
—
and
$messageData = ‘{
“title”: “The Alchemist”
}’;
curl_setopt($curl, CURLOPT_POSTFIELDS, $messageData);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Accept: application/json",
"Authorization: Basic 1234567890",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mautic');
curl_setopt($curl, CURLOPT_POSTFIELDS, $messageData);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_POST, 1);
But no update 🙁
The result shows me the none-update data. What can I do?
Thank you.
Uli
SOLVED 🙂
$data = array(‘password’=>’123’);
$data_json = json_encode($data);
$headers = array(
“Content-Type: application/json; charset=utf-8”,
“Content-Length: ” .strlen($data_json),
“Authorization: Basic asadasdasdasdasd”,
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, “PUT”);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data_json);
$resp = curl_exec($curl);
curl_close($curl);`