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

php curl 抓取 post数据
标签: