PHP ?? ???? ???? ???? ????.
post? ???? ??? ???
POST ???? ??? ??? ??? ?? ???? ???? ????? ?? ???? ???.
??? ?? post?? ??? ??? ??????. post ???? ? ?? ????? ???? ???:
1. ??? URL ??
2. ??? ???
??? ???? ?? ??? ?? ?????. ? ??? ????? ??? ??? ??? ???? POST ???? ??????.
"15.1 ? ?? ??"? ???? ?? ??? ?????.
??? ?? ??? ???? ?? WeChat ?? ??? ??? ? POST ???? ???? ??? ?? ?? ???? WeChat? ??? ?? ?? ?????? ??? ???.
Post? ??? ?? ??, ?? ??? ??? ????.
<?php function post($url, $data) { //初使化init方法 $ch = curl_init(); //指定URL curl_setopt($ch, CURLOPT_URL, $url); //設(shè)定請求后返回結(jié)果 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //聲明使用POST方式來進(jìn)行發(fā)送 curl_setopt($ch, CURLOPT_POST, 1); //發(fā)送什么數(shù)據(jù)呢 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //忽略證書 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //忽略header頭信息 curl_setopt($ch, CURLOPT_HEADER, 0); //設(shè)置超時時間 curl_setopt($ch, CURLOPT_TIMEOUT, 10); //發(fā)送請求 $output = curl_exec($ch); //關(guān)閉curl curl_close($ch); //返回數(shù)據(jù) return $output; } ?>
???? WeChat ?? ??? ?? ?? ?? API ???? ?????. ??? ??? ??? ?? POST ???? ???? ???.
POST? ???? ???? ???? ?? ?? POST ??? ???? ???.