Comments (7)
Since multipart requests don't work with "php://input", I had to rebuild the request for the guzzle multipart option, example:
$gzOptions = [
'verify' => false,
'cookies' => true
];
#PATCH for multipart requests.
if ( $_SERVER['REQUEST_METHOD'] === 'POST' && stristr( $_SERVER['CONTENT_TYPE'], 'multipart' ) ) {
unset( $_SERVER['CONTENT_TYPE'] );
//Run Request Factory AFTER, not before.
$multipart = urldecode( http_build_query( $_POST ) );
$multipartArr = strstr( $multipart, '&' ) ? explode( '&', $multipart ) : [ $multipart ];
foreach ( $multipartArr as $pair ) {
$pairArr = strstr( $pair, '=' ) ? explode( '=', $pair ) : [ $pair ];
$gzOptions['multipart'][] = [ 'name' => $pairArr[0], 'contents' => isset( $pairArr[1] ) ? $pairArr[1] : '' ];
}
}
$guzzle = new GuzzleHttp\Client( $gzOptions );
// Create a PSR7 request based on the current browser request.
$request = ServerRequestFactory::fromGlobals();
If this can be simplified then I would love to hear in case I'm missing something.
from php-proxy.
Can you try the latest version and report back? I will close this until then.
from php-proxy.
I see the codebase changed quite a bit. I wrote a workaround back when I reported the issue. I'm sorry I can't test this as-is.
But it should be easy to do a html from with multipart/form-data
and check if $_POST is filled on the behind-proxy-side.
Anyway thank you for looking into it.
from php-proxy.
The current code now uses Symfony request/response objects and Guzzle to send and receive the requests. It makes it more flexible and easier to use for developers.
from php-proxy.
l am using the basic example code. POST url encoded or JSON is not sent with the redirect. Is there something l am missing.
from php-proxy.
I have the same problem, the multipart post content is not transmitted to the proxified target, i'm not sure where the posted data gets lost as I debugged and reached the guzzle client stream_for php//input
Is a multipart/form-data; boundary=----WebKitFormBoundaryblabla..
Tried using the guzzle5 branch with symphony, but no option for stackhandlers with guzzle v5 .
from php-proxy.
Any updates on this?
from php-proxy.
Related Issues (20)
- Class ServerRequestFactory not found HOT 5
- Problems with POST and forms HOT 4
- stress test exception!!
- Fatal error: Uncaught Error: Class 'Zend\Diactoros\Response\SapiEmitter' not found HOT 1
- Port gets lost on forwarded webpage.
- Zend\Diactoros\Response\SapiEmitter has been depricated HOT 4
- How can I send basic authentication with request? HOT 1
- HTTP ERROR 500 HOT 1
- Here's an alternative for Laravel 7, or PHP only:
- upload file proxy invalid HOT 2
- Need example how to change response body HOT 1
- Doesn't work with Laravel 8 HOT 3
- .
- EmitterException: Output has been emitted previously HOT 1
- Response of url to a varible
- POST form_params is not passed down/proxied at all
- Skip Ajax Requests
- Urls not redirected.
- How to forward to different Port?
- Failed opening required 'vendor/autoload.php'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-proxy.