search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

Home PHP Libraries Other libraries PHP class to send POST request
PHP class to send POST request The
<?php
class Request{
public static function post($url, $post_data = '', $timeout = 5){//curl
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
$file_contents = curl_exec($ch);
curl_close($ch);

Post() function is used to send non-PowerBuilder predefined event messages to the window. This window can be the window of the PowerBuilder application or the window of other applications. The Post() function places the sent message at the end of the specified window message queue and then returns it to the application. It does not wait for the execution of the corresponding event handler. This is different from the Send() function. The Send() function directly triggers the corresponding event of the specified window and returns to the calling application after executing the event handler. Therefore, we say that the Post() function uses an asynchronous method, and the Send() function uses a synchronous method. The parameter handle of the Post() function specifies the window handle for receiving the message. For the PowerBuilder window, the handle can be obtained using the Handle() function. For windows of other applications, you can call the system API function to find the window and get the handle of the corresponding window. If the application wants to post PowerBuilder defined events (including predefined events and user-defined events), then using the PostEvent() function is simple and convenient. When the application specifies a string in the long parameter position, the Post() function makes a copy of the string and then transmits the address of the copy to the specified window.


Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: [email protected]

How to send a POST request in Java? How to send a POST request in Java?

06 Dec 2025

Answer: Use HttpURLConnection to send a POST request, set the request method to POST and configure Content-Type, write JSON or form data through OutputStream, and then read the response. For example, submit {name: "John", age: 30} to https://httpbin.org/post to get the returned results. For complex requirements, the ApacheHttpClient library can be used to implement more concise code.

How to send JSON in a POST request with Golang? How to send JSON in a POST request with Golang?

24 Nov 2025

DefineastructwithJSONtagslikeUserfornameandemail.2.Usejson.MarshaltoconvertthestructtoJSONdata.3.SendtheJSONusinghttp.Postwithapplication/jsoncontenttypeviabytes.NewBuffer.4.Alwayschecktheresponsestatusandreadthebodytohandleresultsorerrorsproperly.

How to send a POST request with JavaScript? (Fetch API Example) How to send a POST request with JavaScript? (Fetch API Example)

22 Dec 2025

Use FetchAPI to send POST requests: 1. JSON data needs to set Content-Type to application/json and stringify; 2. Form data is automatically processed with FormData; 3. Response.ok or status needs to be manually checked to handle HTTP errors; 4. Authentication tokens are added through headers.

How to send a POST request using Fetch in JavaScript? (API Integration) How to send a POST request using Fetch in JavaScript? (API Integration)

23 Feb 2026

The main reason why fetchPOSTbody does not take effect is that the Content-Type is not set or the body format does not match: JSON requires headers to be set to 'application/json' and the body to use JSON.stringify(); form data uses URLSearchParams; FormData does not set Content-Type manually.

How to correctly use XMLHttpRequest to send an asynchronous POST request and handle the response How to correctly use XMLHttpRequest to send an asynchronous POST request and handle the response

15 Mar 2026

This article explains in detail the root cause of "empty response" in XMLHttpRequest asynchronous requests - reading the responseText directly without waiting for the request to complete, and provides the correct writing method based on event monitoring. It also compares and recommends a more modern and concise Fetch API implementation solution.

Node.js POST Request PHP: Guide to Resolving 400 Bad Request Error Node.js POST Request PHP: Guide to Resolving 400 Bad Request Error

31 Jan 2026

This tutorial aims to solve the common "400 Bad Request" error when Node.js client sends POST request to PHP backend. The article provides an in-depth analysis of one of the main causes of this error - the lack of leading slashes in the path parameter in the Node.js http.request configuration. By providing corrected Node.js and PHP code examples, this tutorial will guide developers on how to correctly construct HTTP requests to ensure that data can be successfully submitted from Node.js to the PHP server, and provide relevant best practices to improve the stability and security of cross-platform data interaction.

Show More