The most basic operations are as follows
<span $curlPost</span> = 'a=1&b=2';<span //</span><span 模拟POST数据</span> <span $ch</span> =<span curl_init(); curl_setopt(</span><span $ch</span>, CURLOPT_HTTPHEADER, <span array</span>('X-FORWARDED-FOR:0.0.0.0', 'CLIENT-IP:0.0.0.0')); <span //</span><span 构造IP</span> curl_setopt(<span $ch</span>, CURLOPT_REFERER, "http://www.baidu.com/"); <span //</span><span 构造来路 </span> curl_setopt(<span $ch</span>,CURLOPT_URL, 'http://www.baidu.com'<span );<span //需要抓取的页面路径</span> curl_setopt (</span><span $ch</span>, CURLOPT_RETURNTRANSFER, 1<span ); curl_setopt (</span><span $ch</span>, CURLOPT_TIMEOUT, 30<span ); curl_setopt(</span><span $ch</span>, CURLOPT_POSTFIELDS, <span $curlPost</span>);<span //</span><span post值</span> <span $file_contents</span> = curl_exec(<span $ch</span>);<span //</span><span 抓取的内容放在变量中</span> curl_close(<span $ch</span>)