一般php采集代码能用的到,这里只是简单的实现代码。
代码如下:
<?php
$title=’gaodaima搞代码网‘;
$hello=’gaodaima.com!’;
$file=file_get_contents(‘http://www.baidu.com’);
$file=iconv(“gbk//IGNORE”,”utf-8″,$file);
//echo $file;
echo strpos($file,’‘);
echo substr($file,strpos($file,’‘)+7,strpos($file,’ ‘-strpos($file,’‘)+7));
$file=str_replace来源gaodaima#com搞(代@码网(array(‘百度一下’,'{hello}’),array($title,$hello), $file);
?>
$title=’gaodaima搞代码网‘;
$hello=’gaodaima.com!’;
$file=file_get_contents(‘http://www.baidu.com’);
$file=iconv(“gbk//IGNORE”,”utf-8″,$file);
//echo $file;
echo strpos($file,’
echo substr($file,strpos($file,’
$file=str_replace来源gaodaima#com搞(代@码网(array(‘百度一下’,'{hello}’),array($title,$hello), $file);
?>
下面是渝海用的小偷程序代码。大家可以多看下。gaodaima搞代码网提供多款小偷程序。
代码如下:
<?php
function _url($Date){
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, “$Date”);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)”);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
return $contents;
}
$url=”https://www.gaodaima.com”;
$contents.=_url($url);
echo $contents; //输出内容
?>
function _url($Date){
$ch = curl_init();
$timeout = 5;
curl_setopt ($ch, CURLOPT_URL, “$Date”);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)”);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
return $contents;
}
$url=”https://www.gaodaima.com”;
$contents.=_url($url);
echo $contents; //输出内容
?>
以上就是php读取html并截取字符串的简单代码的详细内容,更多请关注gaodaima搞代码网其它相关文章!