Loading... # [php curl 抓取 post数据](https://blog.p2hp.com/archives/917) ```php <?php $post_data = array ( 'kw' => 'php', //表单名及内容 'submit' => 'Submit' //提交 ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.somexxx.com/baidu/words.aspx'); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, count($post_data)); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); $output = curl_exec($ch); curl_close($ch); preg_match('#<div id="contenthtml">.*</table>#s',$output,$content); print_r($content); ?> ``` 最后修改:2023 年 08 月 07 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏