源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php读取html并截取字符串的简单代码

  • 时间:2021-06-09 22:26 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php读取html并截取字符串的简单代码
[u]复制代码[/u] 代码如下:
<?php $title='编程素材网'; $hello='jb51.net!'; $file=file_get_contents('http://www.baidu.com'); $file=iconv("gbk//IGNORE","utf-8",$file); //echo $file; echo strpos($file,'<title>'); echo substr($file,strpos($file,'<title>')+7,strpos($file,'</title>'-strpos($file,'<title>')+7)); $file=str_replace(array('百度一下','{hello}'),array($title,$hello), $file); ?>
下面是渝海用的小偷程序代码。大家可以多看下。编程素材网提供多款小偷程序。
[u]复制代码[/u] 代码如下:
<?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="http://www.1sucai.cn"; $contents.=_url($url); echo $contents; //输出内容 ?>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部