When uploading a csv file and a JSON object at the following endpoint
@PostMapping(value = "dataset/rows/query", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
Mono<List<Integer>> getRowsByQuery(@RequestPart("dataset") Mono<FilePart> file,
@RequestPart("query") QueryDTO query){
return Mono.just(new ArrayList<>());
}
I get the following error:
2020-12-17 12:25:05.142 ERROR 195281 --- [or-http-epoll-3] a.w.r.e.AbstractErrorWebExceptionHandler : [d418565e-17] 500 Server Error for HTTP POST "/dataset/rows/query"
org.springframework.core.io.buffer.DataBufferLimitException: Part headers exceeded the memory usage limit of 8192 bytes
at org.springframework.http.codec.multipart.MultipartParser$HeadersState.onNext(MultipartParser.java:360) ~[spring-web-5.3.1.jar:5.3.1]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
|_ checkpoint ⇢ HTTP POST "/dataset/rows/query" [ExceptionHandlingWebHandler]
Stack trace:
at org.springframework.http.codec.multipart.MultipartParser$HeadersState.onNext(MultipartParser.java:360) ~[spring-web-5.3.1.jar:5.3.1]
at org.springframework.http.codec.multipart.MultipartParser.hookOnNext(MultipartParser.java:104) ~[spring-web-5.3.1.jar:5.3.1]
at org.springframework.http.codec.multipart.MultipartParser.hookOnNext(MultipartParser.java:46) ~[spring-web-5.3.1.jar:5.3.1]
at reactor.core.publisher.BaseSubscriber.onNext(BaseSubscriber.java:160) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:199) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:120) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:265) ~[reactor-netty-core-1.0.1.jar:1.0.1]
at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:371) ~[reactor-netty-core-1.0.1.jar:1.0.1]
at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:381) ~[reactor-netty-core-1.0.1.jar:1.0.1]
at reactor.netty.http.server.HttpServerOperations.onInboundNext(HttpServerOperations.java:535) ~[reactor-netty-http-1.0.1.jar:1.0.1]
at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:94) ~[reactor-netty-core-1.0.1.jar:1.0.1]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at reactor.netty.http.server.HttpTrafficHandler.channelRead(HttpTrafficHandler.java:229) ~[reactor-netty-http-1.0.1.jar:1.0.1]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) ~[netty-codec-4.1.54.Final.jar:4.1.54.Final]
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311) ~[netty-codec-4.1.54.Final.jar:4.1.54.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:425) ~[netty-codec-4.1.54.Final.jar:4.1.54.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[netty-codec-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.54.Final.jar:4.1.54.Final]
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) ~[netty-transport-native-epoll-4.1.54.Final-linux-x86_64.jar:4.1.54.Final]
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) ~[netty-transport-native-epoll-4.1.54.Final-linux-x86_64.jar:4.1.54.Final]
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) ~[netty-transport-native-epoll-4.1.54.Final-linux-x86_64.jar:4.1.54.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[netty-common-4.1.54.Final.jar:4.1.54.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.54.Final.jar:4.1.54.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.54.Final.jar:4.1.54.Final]
at java.base/java.lang.Thread.run(Thread.java:832) ~[na:na]
I tried to customize the defaultCodex().maxinMemorySize() by
@Component
public class ServerConfiguration implements WebFluxConfigurer {
@Override
public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
configurer.defaultCodecs().maxInMemorySize(16 * 1024 * 1024);
}
}
and the following application.yml
server:
port: ${SERVER_PORT:8080}
max-http-header-size: 900000000
spring:
codec:
max-in-memory-size: 900000000
but it doesn’t seem to have any effect.
Moreover, what is strange is that the error on the server side only seems to happen when calling the API from Angular, but not from postman.
From Angular I have the following headers:
POST /dataset/rows/query HTTP/1.1
Host: localhost:4200
Connection: keep-alive
Content-Length: 496570
Pragma: no-cache
Cache-Control: no-cache
Accept: */*
DNT: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarySBh6gJvnTeDzB43Y
Origin: http://localhost:4200
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:4200/app
Accept-Encoding: gzip, deflate, br
Accept-Language: it-IT,it;q=0.9,en-GB;q=0.8,en;q=0.7,ru-RU;q=0.6,ru;q=0.5,en-US;q=0.4
and finally, this is the corresponding OpenAPI yaml for the endpoint:
openapi: 3.0.1
info:
title: OpenAPI definition
version: v0
servers:
- url: http://localhost:8080
description: Generated server url
paths:
/dataset/rows/query:
post:
tags:
- dataset-controller
operationId: getRowsByQuery
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
dataset:
type: string
format: binary
query:
$ref: '#/components/schemas/QueryDTO'
responses:
"200":
description: OK
content:
'*/*':
schema:
type: array
items:
type: integer
format: int32
components:
schemas:
PredicateDTO:
type: object
properties:
value:
type: object
key:
type: string
operator:
type: string
enum:
- EQUAL
- NOT_EQUAL
- BELONGING
- NOT_BELONGING
- GREATER_THAN
- GREATER_THAN_EQUAL
- LESS_THAN
- LESS_THAN_EQUAL
QueryDTO:
type: object
properties:
predicates:
type: object
additionalProperties:
$ref: '#/components/schemas/PredicateDTO'
Here is my dataset and my json object.
How can I increase the Part headers memory usage limit?
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: Header value exceeds the 8192 size limit
#0 IOClient.send (package:http/src/io_client.dart:62:7)
<asynchronous suspension>
#1 BaseClient._sendUnstreamed (package:http/src/base_client.dart:176:38)
#2 BaseClient.post (package:http/src/base_client.dart:58:7)
#3 post.<anonymous closure> (package:http/http.dart:70:16)
#4 _withClient (package:http/http.dart:166:20)
#5 post (package:http/http.dart:69:5)
#6 UserAuthenticationService.authenticate (package:halivent/models/user_authentication_service.dart:143:36)
info • Unused import: 'package:halivent/screens/action_screen.dart' • lib/models/action_item_service.dart:15:8 • unused_import
info • Unused import: 'dart:async' • lib/models/conversation.dart:1:8 • unused_import
info • Unused import: '../themes.dart' • lib/models/conversation.dart:7:8 • unused_import
info • Unused import: 'package:halivent/models/user_connections.dart' • lib/models/conversation_message_attachment_action.dart:4:8 • unused_import
info • The value of the local variable 'statuses' isn't used • lib/models/platform_permission_service.dart:34:45 • unused_local_variable
info • Unused import: 'dart:convert' • lib/screens/attachment_image_screen.dart:1:8 • unused_import
info • Unused import: 'package:flutter/services.dart' • lib/screens/attachment_image_screen.dart:5:8 • unused_import
info • The value of the field '_error' isn't used • lib/screens/attachment_image_screen.dart:21:10 • unused_field
info • The value of the local variable 'asset' isn't used • lib/screens/attachment_image_screen.dart:173:27 • unused_local_variable
info • Unused import: 'package:halivent/models/conversation_message.dart' • lib/screens/attachment_poll_screen.dart:3:8 • unused_import
info • Unused import: 'package:provider/provider.dart' • lib/screens/authentication_signin_screen.dart:11:8 • unused_import
info • Unused import: 'dart:math' • lib/screens/connections_screen.dart:1:8 • unused_import
info • Unused import: 'conversation_initiation_screen.dart' • lib/screens/conversations_screen.dart:11:8 • unused_import
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/screens/group_creation_screen.dart:160:91 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/screens/group_creation_screen.dart:269:66 • deprecated_member_use
info • The declaration '_getPosition' isn't referenced • lib/screens/plan_eventuality_screen.dart:29:3 • unused_element
info • Unused import: 'package:geolocator/geolocator.dart' • lib/screens/plan_screen.dart:6:8 • unused_import
info • Unused import: 'package:halivent/models/platform_permission_service.dart' • lib/screens/plan_screen.dart:8:8 • unused_import
info • Unused import: 'package:halivent/widgets/conversation_item_widget.dart' • lib/screens/share_with_screen.dart:10:8 • unused_import
info • 'display1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline4. This
feature was deprecated after v1.13.8. • lib/themes.dart:61:3 • deprecated_member_use
info • 'headline' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline5. This
feature was deprecated after v1.13.8. • lib/themes.dart:62:3 • deprecated_member_use
info • 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature
was deprecated after v1.13.8. • lib/themes.dart:63:3 • deprecated_member_use
info • 'subtitle' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is subtitle2. This
feature was deprecated after v1.13.8. • lib/themes.dart:64:3 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/themes.dart:65:3 • deprecated_member_use
info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature
was deprecated after v1.13.8. • lib/themes.dart:66:3 • deprecated_member_use
info • 'display1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline4. This
feature was deprecated after v1.13.8. • lib/themes.dart:71:3 • deprecated_member_use
info • 'headline' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline5. This
feature was deprecated after v1.13.8. • lib/themes.dart:72:3 • deprecated_member_use
info • 'title' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is headline6. This feature
was deprecated after v1.13.8. • lib/themes.dart:73:3 • deprecated_member_use
info • 'subtitle' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is subtitle2. This
feature was deprecated after v1.13.8. • lib/themes.dart:74:3 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/themes.dart:75:3 • deprecated_member_use
info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature
was deprecated after v1.13.8. • lib/themes.dart:76:3 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/themes.dart:189:52 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/themes.dart:218:52 • deprecated_member_use
info • Name non-constant identifiers using lowerCamelCase • lib/utils/stomp_custom_client.dart:57:8 • non_constant_identifier_names
info • Unused import: 'package:halivent/models/user.dart' • lib/views/registration_contact_info.dart:3:8 • unused_import
info • The member 'setState' can only be used within instance members of subclasses of 'package:flutter/src/widgets/framework.dart' •
lib/views/registration_contact_info.dart:48:31 • invalid_use_of_protected_member
info • The member 'setState' can only be used within instance members of subclasses of 'package:flutter/src/widgets/framework.dart' •
lib/views/registration_contact_info_verification.dart:45:29 • invalid_use_of_protected_member
info • The member 'setState' can only be used within instance members of subclasses of 'package:flutter/src/widgets/framework.dart' •
lib/views/registration_contact_info_verification.dart:58:27 • invalid_use_of_protected_member
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/widgets/connection_item_widgets.dart:75:60 • deprecated_member_use
info • 'body2' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText1. This feature
was deprecated after v1.13.8. • lib/widgets/connection_item_widgets.dart:84:30 • deprecated_member_use
info • Unused import: '../constants.dart' • lib/widgets/message_attachment_action_widget.dart:11:8 • unused_import
info • Unused import: 'package:halivent/models/conversation_service.dart' • lib/widgets/message_attachment_images_widget.dart:8:8 • unused_import
info • Unused import: '../endpoints.dart' • lib/widgets/message_attachment_images_widget.dart:11:8 • unused_import
info • Unused import: 'dart:math' • lib/widgets/message_attachment_pool_widget.dart:1:8 • unused_import
info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature
was deprecated after v1.13.8. • lib/widgets/message_attachment_pool_widget.dart:195:53 • deprecated_member_use
info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature
was deprecated after v1.13.8. • lib/widgets/message_attachment_pool_widget.dart:229:49 • deprecated_member_use
info • Name non-constant identifiers using lowerCamelCase • lib/widgets/message_text_bot_widget.dart:162:14 • non_constant_identifier_names
info • Name non-constant identifiers using lowerCamelCase • lib/widgets/message_text_widget.dart:401:14 • non_constant_identifier_names
info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The modern term is bodyText2. This feature
was deprecated after v1.13.8. • lib/widgets/scroll_bar_widget.dart:34:52 • deprecated_member_use
info • Unused import: 'dart:convert' • test/utils/rsa_encryption_client_test.dart:1:8 • unused_import
[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.15.4 19E287, locale en-US)
• Flutter version 1.17.0 at /Users/kentaki/apps/flutter
• Framework revision e6b34c2b5c (5 days ago), 2020-05-02 11:39:18 -0700
• Engine revision 540786dd51
• Dart version 2.8.1
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/kentaki/Library/Android/sdk
• Platform android-29, build-tools 28.0.3
• ANDROID_HOME = /Users/kentaki/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.1, Build version 11A1027
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 41.1.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[!] IntelliJ IDEA Ultimate Edition (version 2018.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[!] VS Code (version 1.44.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• Nexus 6P • 84B7N17317001023 • android-arm64 • Android 8.1.0 (API 27)
• iPhone 11 Pro • B61F2464-E302-467D-9DE3-08DAA65E9E27 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-1 (simulator)
! Doctor found issues in 2 categories.
- Community Home
Ask a question
Sign in
Sign in
- My Verizon Member
- Community Member only
You must be signed in to access this part of the community.
Sign in using Community account
Username
Password
Remember me
Remember my username. Stores your username on this computer. You should not use this feature on public computers.
First time logging in? Reset your password.
Register
Forgot your info
Sign in using My Verizon account
У меня есть приложение для Android отправить данные JSON на веб-сервис php, запущенный на Сервер WAMP.
Когда я отправляю много записей через JSON, у меня появляется ошибка:
"Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit."
я был изменен конфигурация в php.ini лайк
upload_max_file_size в 64M а также upload_max_filesize в 64M
Как я могу решить это, пожалуйста?
0
Решение
Это связано с тем, что ваш веб-сервис http (apache?) Не разрешает запросы с данными, превышающими параметр LimitRequestFieldSize (по умолчанию 8190 байт)
Похоже, что один из ваших запросов JSON слишком велик или сумма файлов cookie слишком велика, и веб-служба блокирует его.
Кстати, увеличение LimitRequestFieldSize не очень хорошая идея из-за риска атак DOS.
Попробуйте свести к минимуму / очистить куки или упростить запрос Json.
3
Другие решения
Вы пытаетесь включить параметр LimitRequestFieldSize httpd.conf или файл .htaccess.
Использование здесь: Apache Docs
1
если вам нужно передавать большие данные (например, между API-интерфейсами с JSON в вашем случае), вместо использования запроса GET и размещения данных в заголовках, используйте запрос POST и отправляйте данные в теле.
С помощью POST вы все еще можете использовать заголовки для проверки токенов или небольших данных, но снова отправлять большие данные JSON, которые не помещаются в заголовки в теле POST.
Вот полная система для отправки данных JSON с помощью PHP:
### Sender PHP Side:
# Core function that sends big data with POST:
function curl_post($url, $header, $data){
$CURL = curl_init();
curl_setopt($CURL, CURLOPT_URL, $url);
curl_setopt($CURL, CURLOPT_POST, TRUE);
curl_setopt($CURL, CURLOPT_HTTPHEADER, $header);
curl_setopt($CURL, CURLOPT_POSTFIELDS, $data);
curl_setopt($CURL, CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($CURL);
$http_code = curl_getinfo($CURL, CURLINFO_HTTP_CODE);
curl_close($CURL);
return array($http_code, $result);
}
# Prepare your data and send:
$url = "https://example.com/api.php";
$header = array(
"Content-Type: text/html",
"verify: <your fixed code to verify the request is legit>",
"anything: <you can send anything with headers here but the text you send should be SMALL>");
list($http_code, $result) = curl_post($url, $header, json_encode($your_big_data));
echo "http_code: $http_code<br>result: $result";
###########################
### Receiver PHP Side: (api.php in our example)
if (function_exists("apache_request_headers")) {$myHeaders = apache_request_headers();}
# See the headers you posted from other side:
print_r($myHeaders);
# See the JSON POST body you posted from other side:
echo file_get_contents('php://input');
0