WordPress "415 Unsupported Media Type" Ошибка "Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 WordPress "415 Unsupported Media Type" Ошибка "

Сообщение Anonymous »

Я был бы признателен за вашу помощь в отношении довольно абсурдной ошибки, с которой я столкнулся. Фактически, в настоящее время он работает без каких-либо проблем на Localhost и на другом сайте. Различный плагин, который я разработал, имеет функцию проверки лицензии. Он отправляет данные через удаленное соединение, и если лицензионный ключ верен, плагин продолжает работать без каких -либо проблем. < /P>

Код: Выделить всё

    // Prepares the payload with site and plugin information.
$payload = [
'purchase_code' => $code,
'domain' => wp_parse_url( home_url(), PHP_URL_HOST ),
'site_url' => home_url( '/' ),
'install_id' => self::get_install_id(),
'plugin' => 'tmdb-scb',
'version' => defined( 'TMDB_SCB_VERSION' ) ? TMDB_SCB_VERSION : '1.0.0',
];

// Configures the arguments for the remote request.
$args = [
'headers' => [
'Content-Type' => 'application/json',
],
'timeout' => 10,
'sslverify' => true,
'body' => wp_json_encode( $payload ),
];
< /code>
Когда я проверяю журнал отладки, я получаю следующий вывод.  < /p>
(
[headers] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object
(
[data:protected] => Array
(
[server] => openresty/1.27.1.1
[date] => Sun, 14 Sep 2025 11:41:43 GMT
[content-type] => text/html
[content-length] => 185
)

)

[body] => 
415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[response] => Array
(
[code] => 415
[message] => Unsupported Media Type
)

[cookies] => Array
(
)

[filename] =>
[http_response] => WP_HTTP_Requests_Response Object
(
[data] =>
[headers] =>
[status] =>
[response:protected] => WpOrg\Requests\Response Object
(
[body] => 
415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[raw] => HTTP/1.1 415 Unsupported Media Type
Server: openresty/1.27.1.1
Date: Sun, 14 Sep 2025 11:41:43 GMT
Content-Type: text/html
Content-Length: 185
Connection: close


415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[headers] => WpOrg\Requests\Response\Headers Object
(
[data:protected] => Array
(
[server] => Array
(
[0] => openresty/1.27.1.1
)

[date] => Array
(
[0] => Sun, 14 Sep 2025 11:41:43 GMT
)

[content-type] => Array
(
[0] => text/html
)

[content-length] => Array
(
[0] => 185
)

)

)

[status_code] => 415
[protocol_version] => 1.1
[success] =>
[redirects] => 0
[url] => https://www.metinmete.com.tr/license-check/
[history] => Array
(
)

[cookies] => WpOrg\Requests\Cookie\Jar Object
(
[cookies:protected] => Array
(
)

)

)

[filename:protected] =>
)

)

[14-Sep-2025 11:45:59 UTC] Array
(
[headers] => WpOrg\Requests\Utility\CaseInsensitiveDictionary Object
(
[data:protected] => Array
(
[server] => openresty/1.27.1.1
[date] => Sun, 14 Sep 2025 11:45:58 GMT
[content-type] => text/html
[content-length] => 185
)

)

[body] =>  
415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[response] => Array
(
[code] => 415
[message] => Unsupported Media Type
)

[cookies] => Array
(
)

[filename] =>
[http_response] => WP_HTTP_Requests_Response Object
(
[data] =>
[headers] =>
[status] =>
[response:protected] => WpOrg\Requests\Response Object
(
[body] => 
415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[raw] => HTTP/1.1 415 Unsupported Media Type
Server: openresty/1.27.1.1
Date: Sun, 14 Sep 2025 11:45:58 GMT
Content-Type: text/html
Content-Length: 185
Connection: close


415 Unsupported Media Type

415 Unsupported Media Type
openresty/1.27.1.1



[headers] => WpOrg\Requests\Response\Headers Object
(
[data:protected] => Array
(
[server] => Array
(
[0] => openresty/1.27.1.1
)

[date] => Array
(
[0] => Sun, 14 Sep 2025 11:45:58 GMT
)

[content-type] => Array
(
[0] => text/html
)

[content-length] => Array
(
[0] => 185
)

)

)

[status_code] => 415
[protocol_version] => 1.1
[success] =>
[redirects] => 0
[url] => https://www.metinmete.com.tr/license-check/
[history] => Array
(
)

[cookies] => WpOrg\Requests\Cookie\Jar Object
(
[cookies:protected] => Array
(
)

)

)

[filename:protected] =>
)

)

Плагин SVG, который я установил, вызвал проблему, но, честно говоря, я не мог понять или найти проблему.

Подробнее здесь: https://stackoverflow.com/questions/797 ... type-error
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»