如何通过PHP发送POST请求并处理JSON数据?
- 内容介绍
- 文章标签
- 相关推荐
本文共计62个文字,预计阅读时间需要1分钟。
phpfunction http_post_data($url, $data_string) { $ch=curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);}
function www.xxxx.com"; $data = json_encode(array('cmd'=>"Query_Ranking_Sys",'group'=>1,'room'=>0,'name'=>"RoomSvr",'value'=>array(0=>array('key'=>5,'beginindex'=>0,'count'=>10)))); list($return_code, $return_content) = http_post_data($url, $data);
本文共计62个文字,预计阅读时间需要1分钟。
phpfunction http_post_data($url, $data_string) { $ch=curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);}
function www.xxxx.com"; $data = json_encode(array('cmd'=>"Query_Ranking_Sys",'group'=>1,'room'=>0,'name'=>"RoomSvr",'value'=>array(0=>array('key'=>5,'beginindex'=>0,'count'=>10)))); list($return_code, $return_content) = http_post_data($url, $data);

