首页
导航
博客
电子书
算法
众创
代码
随贴
关于我们
您好,欢迎来到码863代码分享网! 请
[登录]
/
[注册]
搜 索
一句话概述代码的用途:
*
(例: 使用js控制复制及输入数据时只能是数字)
120
字
代码类型:
无
函数
类
插件
单段代码直接可运行
TAG标签:
(用空格隔开)
30
字
描述说明:
请填写代码的实现原理、应用场景、功能说明、调用示例、注意事项等。
代码正文:
*
请选择语言
html
python
javascript
php
sql
c
c++
c#
java
plain
简单说明:
排序:
测试一下
setTimeout(\'location.href="http://218.249.164.250:2048/login?url=http://www.cnki.net"\',3000);'; /** * 抓取一个页面 * @param str $url= "https://cn-virtual.excalibur.com.hk:5512/spadmin/english/validate.php"; 需要登陆验证的页面地址 * @param str $get_content_url 采集登陆后的页面 * @param str $post_fields= "username=FENGKONG&password=368382368382"; post串 * @param str $User_Agent = "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"; user_agent信息 如“baiduspider”或“googlebot” * @param str $Referer_Url = 'http://www.baidu.com/'; 来源页 */ function getSourcesHttps($Url='http://218.249.164.250:2048/login',$get_content_url='http://218.249.164.250:2048/menu',$post_fields= "user=20070017&pass=a147258369&url=^U",$User_Agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',$Referer_Url='https://www.baidu.com/') //抓取某个指定的页面 { $cookie_file=tempnam('./temp','cookie'); $ch = curl_init($Url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $User_Agent); curl_setopt($ch, CURLOPT_REFERER, $Referer_Url); #curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); #curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); $MySources1 = curl_exec ($ch); curl_close($ch); $url=$get_content_url; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $User_Agent); curl_setopt($ch, CURLOPT_REFERER, $Url); #curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); #curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); $MySources2 = curl_exec($ch); curl_close($ch); return $MySources2; } /** * 取两个串之间内容 如参数一个为空返回为空 * @param str first str; * @param str second str; * @param str haystack; 其中没有first或second 返回空 * @return str 成功返回串,失败返回空串 */ function sub_getstr($f,$s,$h) { if(empty($f) ||empty($s) ||empty($h)) return ''; list($part1,$part2)=explode($f,$h,2); empty($part2) ? $get='' : list($get,$tem)=explode($s,$part2,2); if($get===$part2) $get=''; return empty($get) ? '' : $get; } /** * 替换两个串之间内容 把1 2之间内容换成 3 * @param str first str; * @param str second str; * @param str repalce str; * @param str haystack; * @return str 成功返回串,失败返回空串 */ function sub_replace($f,$s,$r,$h) { return str_replace(sub_getstr($f,$s,$h),$r,$h); } /** * 正则取一个串 * @param str $pattern '/a(b)c/' * @return str */ function preg_get($pattern,$file) { preg_match($pattern,$file,$matches); return $matches; } /** * 正则取多个串 返回所有匹配 * @param str $pattern '/a(b)(c)d/' * @return str */ function preg_get_all($pattern,$file) { preg_match_all($pattern,$file,$matches); return $matches; }
CopyRight 2002~2023 精通2100网 联系邮箱:qqtxt@163.com
版权所有:精通2100网
湘ICP备2023018646号-1
MYSQl共执行 4 个查询,用时 0.0019350051879883 秒,PHP脚本用时 0.003962 秒,占用内存 0.509 MB,Gzip 已启用