php get url
来源:互联网 发布:apk优化 编辑:程序博客网 时间:2024/06/01 10:12
<?php//header("Content-Type:text/html;charset=gb2312");header("Content-type:text/html;charset=gb2312");include('simple_html_dom.php');//引入类库文件function getUrlRes($url,$headers){ $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_PROXY, "http://proxynj.zte.com.cn:80"); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = curl_exec($curl); curl_close($curl); return $data;}function printWebUrl($url){ echo '<a href= '. $url.'>'. $url .' </a> <br />';}function parseJsjszpw($html){ $divs = $html->find('#cnzp3 ul li'); foreach ($divs as $value) { $str = $value->children[2]->nodes[0]->_[4]; $str = mb_convert_encoding($str, 'utf-8', 'gbk'); if ( strpos($str,'南京') != false && ( strpos($str,'中学') != false || strpos($str,'小学') != false ) ) { echo ": " .$value->children[2]->nodes[0]->_[4] . "<br />"; } } $html->clear();}$headers = array( 'User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'Accept-Encoding:gzip, deflate', 'Accept-Language:zh-CN,zh;q=0.8', 'Cache-Control:max-age=0', 'Proxy-Connection:keep-alive',);$url ="http://www.jsjszpw.com/";$urlResp = getUrlRes($url, $headers);$html = str_get_html($urlResp);printWebUrl($url);parseJsjszpw($html);?>
阅读全文
0 0
- php get url
- PHP Get the Current Page URL
- PHP: How to Get the Current Page URL
- php 如何获取当前页完整URL及其get参数
- php页面使用get方法 url字符串处理urlencode
- PHP表单提交(POST&GET&URL编/解码)
- get url from plugin
- Get parameters from Url
- $.get( url, [data], [callback] )
- Magento: get skin url, get media url, get base url, get store url
- URL post get
- $.get(url)的疑问
- GET方法请求URL
- get currrent script url
- restFul get url
- Url请求get拼接
- Url请求get拼接
- php get
- 让你的 WordPress 网站更安全的5 个方法
- java String[] args理解
- zipkin+elasticsearch全链路跟踪(springcloud)
- jenkins+selenium grid实现分布式自动化测试
- 【功能笔记】Ubuntu查看系统资源占用(内存,cpu和进程) {转载}
- php get url
- Thread必须知道的几个概念
- Combinatorics——HDUOJ 1294
- 用geotools自己写WMS服务
- CSS中块级元素(block element)和行内元素/内联元素(inline element)
- ArrayList中toArray(T[] a)方法分析
- BMH online judge刷题记——书的复制(二分)
- Leetcode刷题记
- linux内核之问-0.11版本-内核加载-1