php 抓取 搜索引擎中 提供的 网页 是哪个函数? 大家好: 我翻了一下 手册 没有找到 . 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $url="百度"$content=file_get_contents($url);抓回来后可以用正则配出你想要的$sreach="/正则/";@preg_match_all($sreach, $content, $matches); file(URL)抓出来是个数组,自己输出看看.判断一下就OK啦... 一般做采集都用这个函数.你可以去研究一下dedecms. function GetWebContent($host, $method, $path, $str, $sessid){ $fp = fsockopen($host, 80); if (!$fp) { echo "OPEN ERROR"; return; } if ($method == "GET") $path .= '?' . $str; fputs($fp, "$method $path HTTP/1.1\n"); fputs($fp, "Host: $host\n"); if (!empty($sessid)) { fputs($fp, "Cookie: $sessid; path=/;\n"); } fputs($fp, "Content-Type: application/x-www-form-urlencoded\n"); if ($method == "POST") { fputs($fp, "Content-Length: " . strlen($str) . "\n"); } fputs($fp, "Connection: close\n\n"); if ($method == "POST") { fputs($fp, $str . "\n"); } while (!feof($fp)) { $response .= fgets($fp, 1024); } fclose($fp); return $response;} fopenfile_get_contentscurl常用点。 file_get_contents/fsockopen等等…… file_get_contentscurl都比较好用,当时 curl 需要你的 PHP 安装 curl 组件。 php日期控件 为什么我的php验证码不显示,总显示一个红叉,GD已经启动,而且UC的验证码正常显示? 是php配置问题吗? 想做一个广告类的网站,用什么样的框架或者来做比较好? 怎样以下拉菜单形式显示出从数据库中读取的数据? 添加地址链接 smarttemplate中能assign参数吗? 急!!变量传递问题 在PHP中提交表单问题 新手求教~~表单validate验证后,ajaxSubmit()要怎么编写 php页面的作用域 jpgraph 初级问题__有段时间没来不知道怎么的没分了。。。。
$content=file_get_contents($url);
抓回来后可以用正则配出你想要的
$sreach="/正则/";
@preg_match_all($sreach, $content, $matches);
function GetWebContent($host, $method, $path, $str, $sessid)
{
$fp = fsockopen($host, 80);
if (!$fp) {
echo "OPEN ERROR";
return;
}
if ($method == "GET")
$path .= '?' . $str;
fputs($fp, "$method $path HTTP/1.1\n");
fputs($fp, "Host: $host\n");
if (!empty($sessid)) {
fputs($fp, "Cookie: $sessid; path=/;\n");
}
fputs($fp, "Content-Type: application/x-www-form-urlencoded\n");
if ($method == "POST") {
fputs($fp, "Content-Length: " . strlen($str) . "\n");
}
fputs($fp, "Connection: close\n\n");
if ($method == "POST") {
fputs($fp, $str . "\n");
} while (!feof($fp)) {
$response .= fgets($fp, 1024);
}
fclose($fp);
return $response;
}
file_get_contents
curl
常用点。
curl
都比较好用,当时 curl 需要你的 PHP 安装 curl 组件。