Examples of Get and post methods that use HTTP calls in PHP, Getpost
The functions used are curl_init, curl_setopt, Curl_exec,curl_close.
The default is the Get method, and you can choose whether to use headers:
$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, "$url") curl_setopt ($ch, Curlopt_timeout, 2); curl_setopt ($ch, curlopt _header, 1); If set to 0, headercurl_setopt ($ch, curlopt_returntransfer,1) is not used, $result = curl_exec ($ch); Curl_close ($ch);
Post method:
$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, ' $ch '); curl_setopt ($ch, curlopt_post,1); curl_setopt (, Curlopt_ returntransfer,true); $vars =sprintf (' from=%d&to=%d&subject=%s&body=%s ', $from, $to, UrlEncode ($subject ), UrlEncode ($body)); curl_setopt ($ch, Curlopt_postfields, $vars); $ret = Curl_exec ($ch); Curl_close ($ch);
PHP $_post differs from $_get and $_request (online articles are exempt)
HTTP requests have post and get. You can specify that the action is post or get when you write the form form. The variable passed by the Post method is saved in the array $_post, $_get the variable passed by the Get method. Both are included in the $_request.
For example
</form>
In t.php, you can use $_get[' AAA ' to get the data that is filled in on the Web form.
When the action in the form is GET, use $_get;action as POST with $_post. Both are available $_request
[PHP] When to receive value get with post
See if you submit the way is get or post, the general form submission has method specified, address bar is used $_get to fetch, such as: www.tbsoo.com/cases.htm?s=&page=4 page in the Get to fetch, If your page has been submitted from the table dropdowns, then use $_request, or write a judgment, get not to use post to take, but still with REQUEST most convenient
http://www.bkjia.com/PHPjc/887347.html www.bkjia.com true http://www.bkjia.com/PHPjc/887347.html techarticle examples of Get and post methods that use HTTP calls in PHP, the functions used by Getpost are Curl_init, curl_setopt, Curl_exec,curl_close. The default is the Get method, you can choose whether to use header: ...