What this article brings to you is about how PHP curl uses post to send data? Post to send data methods, there is a certain reference value, the need for friends can refer to, I hope to help you.
What if we are going to send post data? We also need to use curl to help us send the data.
Follow the steps to customize a function with the function name: Post. Post This method requires the passing of two parameters:
1. Requested URL address
2. The data sent
The data sent is an array, which is sent to the specified interface address in the form of a key-value pair, using the Post method.
In the development of the public number when creating a custom menu, you need to use the custom menu interface to the Post method to send custom menu data.
Post's custom function, all the code is as follows:
<?phpfunction Post ($url, $data) { //early-order init method $ch = Curl_init (); Specify URL curl_setopt ($ch, Curlopt_url, $url); Set the request to return the result curl_setopt ($ch, Curlopt_returntransfer, 1); The declaration uses the POST method to send curl_setopt ($ch, Curlopt_post, 1); What data is sent? curl_setopt ($ch, Curlopt_postfields, $data); Ignore certificate curl_setopt ($ch, Curlopt_ssl_verifypeer, false); curl_setopt ($ch, Curlopt_ssl_verifyhost, false); Ignore header header information curl_setopt ($ch, Curlopt_header, 0); Set timeout time curl_setopt ($ch, Curlopt_timeout, ten); Send request $output = curl_exec ($ch); Turn off Curl curl_close ($ch); Return the data return $output;}? >
Later in the call public platform or other third-party API system. They need to use the Post method to ask you to send data.
You need to use post to send the data, just need to adjust the post method to do it.