<?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.
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: admin@php.cn
Related Article
![How to Send POST Data to a PHP Script from Android?](https://img.php.cn/upload/article/001/246/273/173550057435252.jpg)
30 Dec 2024
How to Send POST Data in AndroidFor developers proficient in PHP, JavaScript, and other scripting languages but new to Java and Android, this...
![How to Send a Raw POST Request with cURL in PHP?](https://img.php.cn/upload/article/001/246/273/173278039248799.jpg)
28 Nov 2024
How to Send a Raw POST Request Using cURL in PHPIn PHP, cURL is a popular library for sending HTTP requests. This article will demonstrate how to...
![How to Send JSON Data via POST Request using PHP cURL?](https://img.php.cn/upload/article/001/246/273/173182416345829.jpg)
17 Nov 2024
POSTing JSON Data with PHPThis inquiry seeks guidance on sending JSON data via a POST request in PHP. The following code snippet demonstrates how...
![How Can I Use PHP cURL to Send an HTTP POST Request?](https://img.php.cn/upload/article/001/246/273/173498090091940.jpg)
24 Dec 2024
PHP cURL with HTTP POSTIntroductioncURL is a library used in PHP for transferring data over a network. One common use case for cURL is to send...
![How to Properly Send POST Request Data in Go?](https://img.php.cn/upload/article/001/246/273/173421595272497.jpg)
15 Dec 2024
HTTP POST Request Implementation in GoFor those attempting to send POST requests in Go, an issue often encountered is the inability to receive...
![How to Send Multiple Images in a cURL POST Request?](https://img.php.cn/upload/article/001/246/273/173056089177688.jpg)
02 Nov 2024
Using Arrays in cURL POST RequestsIn an attempt to send an array of images using cURL, users may encounter issues where only the first array value...
![](/static/imghw/down_right.png)
![](/static/imghw/taglogo.png)
Hot Tools
![PHP library for dependency injection containers](https://img.php.cn/upload/manual/000/000/001/5e2171bf3c005481.png)
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images
![](/static/imghw/taglogo.png)