Category : post

I am a newbie in php (very newbie!!) and I have to answer a specific question about a POST request in php: $app->post(‘/users’, function (Request $request, Response $response, array $args) { $body = $request->getBody(); $user = new UserRepository(); $user->email = $body[’email’]; $user->password = $body[‘password’]; $use->save(); $response->getBody()->write("User created"); return $response; }); $app->run(); What improvements can I ..

Read more

I want to send an already existing image stored in the $_FILES[‘the_file’]. The $_FILES[‘the_file’] is from the page "img_upload.php" for uploading that image, then it is sent to the "form.php" page where the rest of the form is, and then sent to the processing page named "add_product.php" My problem is that I want to send ..

Read more

I am using PHP 8.0.7, Laravel 8.41.0 and new to Laravel. Building some simple APIs. No issues with GET APIs but having trouble with POST. The $request object is always empty no matter what I did. It just returns []. I am posting below data in Fiddler : User-Agent: Fiddler Content-Type: application/json { "parent_id" = ..

Read more

I’m sorry, I speak a little English. I read it all here. Why not works? No post data. Edited (with Content-type): $postdata = http_build_query( array( ‘request’=> ‘activate’, ‘license-key’=> $_POST [ ‘license-key’ ], ‘http_host’=> $_SERVER [ ‘HTTP_HOST’ ], ‘wp_version’=> $wp_version, ‘theme_version’=> $theme_version ) ); $opts = array( ‘http’=> array( ‘method’=> ‘POST’, ‘header’=> ‘Content-type: application/x-www-form-urlencoded’, ‘content’=> $postdata ..

Read more