php

php curl 抓取 post数据

dafenqi
2023-08-07 / 0 评论 / 11 阅读 / 正在检测是否收录...

php curl 抓取 post数据

<?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);
?>
0

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /www/wwwroot/testblog.58heshihu.com/var/Widget/Archive.php on line 1032

评论 (0)

取消