$url = 'https://www.nangesz.com/wp-comments-post.php'; $data = '{ "id": "17999030", "method": "sayHello", "jsonrpc": "2.0", "params": { "acmac": "00E0614CA7C6", "acconf_version": "2015-10-28-09-45" } }'; $res = http_request($url, $data); var_dump($res); function http_request($url, $data = null){//HTTP请求(支持HTTP/HTTPS,支持GET/POST) $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); if (!empty($data)){ curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $output = curl_exec($curl); curl_close($curl); return $output; }
php模拟get、post提交数据,支持https
阅读:2758 输入:2020-03-09 04:23:12
- 上一篇:谷歌浏览器模拟手机访问移动端网站
- 下一篇:css改变文字选择时的默认背景颜色