当前位置: 首页>>代码示例>>PHP>>正文


PHP Import::crawler方法代码示例

本文整理汇总了PHP中Import::crawler方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::crawler方法的具体用法?PHP Import::crawler怎么用?PHP Import::crawler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Import的用法示例。


在下文中一共展示了Import::crawler方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: curlGet

 function curlGet($url)
 {
     $ch = curl_init();
     $header = "Accept-Charset: utf-8";
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
     curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $temp = curl_exec($ch);
     if (empty($temp)) {
         $temp = Import::crawler()->curl_get_con($url);
     }
     return $temp;
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:21,代码来源:controller.php

示例2: ttest

 function ttest()
 {
     $imgobj = Import::img();
     $crawler = Import::crawler();
     $iconv = Import::gz_iconv();
     require_once SYS_PATH_ADMIN . 'inc' . DS . 'download.php';
     //$crawler->curl_get_con('http://www.womai.com/Product-0-526333.htm');exit;
     //$imgobj->grabImage("http://www.21ej.com/picture/139-848-892.gif",SYS_PATH."test.gif");
     DownImageKeep("http://www.21ej.com/picture/139-848-d892.gif", "http://www.baidu.com", SYS_PATH . "test.gif", "", 0, 1);
     exit;
     $sql = "SELECT tb1.url,tb2.goods_preg_1,tb2.goods_preg_2,tb2.goods_preg_3,tb2.goods_preg_4,tb2.goods_preg_5 FROM `{$this->App->prefix()}goods_cache_url` AS tb1 LEFT JOIN `{$this->App->prefix()}goods_cache_site` AS tb2 ON tb2.gcid = tb1.gcid WHERE tb1.gcid='1' LIMIT 3";
     $rt = $this->App->find($sql);
     $str = "";
     if (!empty($rt)) {
         foreach ($rt as $row) {
             $url = $row['url'];
             echo $con = $crawler->curl_get_con($url);
             exit;
             if (empty($con)) {
                 continue;
             }
             $con = $iconv->ec_iconv('GB2312', 'UTF8', $con);
             //分类
             $goods_preg_1 = $row['goods_preg_1'];
             @preg_match($goods_preg_1, $con, $arr1);
             $catetitle = isset($arr1[1]) ? $arr1[1] : "";
             //标题
             $goods_preg_2 = $row['goods_preg_2'];
             @preg_match($goods_preg_2, $con, $arr2);
             $goodstitle = isset($arr2[1]) ? $arr2[1] : "";
             //价格
             $goods_preg_3 = $row['goods_preg_3'];
             @preg_match($goods_preg_3, $con, $arr3);
             $goodsprice = isset($arr3[1]) ? $arr3[1] : "";
             $goods_preg_4 = $row['goods_preg_4'];
             if (!empty($goods_preg_4)) {
                 $goods_preg_4 = str_replace('"', "'", $goods_preg_4);
                 @preg_match($goods_preg_4, $con, $arr4);
                 $goodsimg = isset($arr4[1]) ? $arr4[1] : "";
                 $simg = "photos/g/" . date('Ym', mktime()) . "/ej" . mktime() . substr($goodsimg, -4);
                 $imgobj->imagescopy("http://www.21ej.com/" . $goodsimg, SYS_PATH . $simg);
             }
             $goods_preg_5 = $row['goods_preg_5'];
             if (!empty($goods_preg_5)) {
                 @preg_match($goods_preg_5, $con, $arr5);
                 $goodsdesc = isset($arr5[1]) ? $arr5[1] : "";
             }
         }
     }
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:50,代码来源:controller.php

示例3: _get_weixin_user_info

 function _get_weixin_user_info($rts = array())
 {
     $t = Common::_return_px();
     $cache = Import::ajincache();
     $cache->SetFunction(__FUNCTION__);
     $cache->SetMode('sitemes' . $t);
     $fn = $cache->fpath(func_get_args());
     if (file_exists($fn) && mktime() - filemtime($fn) < 10000 && !$cache->GetClose()) {
     } else {
         $wecha_id = $rts['wecha_id'];
         $is_subscribe = $rts['is_subscribe'];
         $nickname = $rts['nickname'];
         $headimgurl = $rts['headimgurl'];
         $cityname = $rts['cityname'];
         $provincename = $rts['provincename'];
         if (!empty($wecha_id) && $is_subscribe == '1' && (empty($nickname) || empty($headimgurl) || empty($cityname) || empty($provincename))) {
             //1、更改关注标识 表user_tuijian,user
             //2、更改用户资料
             //3、关注时间、关注排名等
             $rr = $this->action('common', '_get_appid_appsecret');
             $appid = $rr['appid'];
             $appsecret = $rr['appsecret'];
             $access_token = $this->action('common', '_get_access_token');
             //获取用户信息
             $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $access_token . '&openid=' . $wecha_id;
             $con = Import::crawler()->curl_get_con($url);
             $json = json_decode($con);
             $subscribe = $json->subscribe;
             $nickname = isset($json->nickname) ? $json->nickname : '';
             $sex = isset($json->sex) ? $json->sex : '';
             $city = isset($json->city) ? $json->city : '';
             $province = isset($json->province) ? $json->province : '';
             $headimgurl = isset($json->headimgurl) ? $json->headimgurl : '';
             $subscribe_time = isset($json->subscribe_time) ? $json->subscribe_time : '';
             $this->Session->write('User.subscribe', $subscribe);
             setcookie(CFGH . 'USER[SUBSCRIBE]', $subscribe, mktime() + 2592000);
             $dd = array();
             if (!empty($nickname)) {
                 $dd['nickname'] = $nickname;
             }
             if (!empty($sex)) {
                 $dd['sex'] = $sex;
             }
             if (!empty($city)) {
                 $dd['cityname'] = $city;
             }
             if (!empty($province)) {
                 $dd['provincename'] = $province;
             }
             if (!empty($headimgurl)) {
                 $dd['headimgurl'] = $headimgurl;
             }
             if (!empty($subscribe_time)) {
                 $dd['subscribe_time'] = $subscribe_time;
             }
             if (!empty($dd)) {
                 $dd['is_subscribe'] = $json->subscribe;
                 $uid = $this->Session->read('User.uid');
                 $this->App->update('user', $dd, 'user_id', $uid);
             }
         }
         //
         $rt = "run";
         $cache->write($fn, $rt, 'rt');
     }
     return true;
 }
开发者ID:jasonhzy,项目名称:wxfx,代码行数:67,代码来源:controller.php

示例4: runlib

 function runlib()
 {
     $thisurl = Import::basic()->thisurl();
     $s = "de";
     $ss = "base" . 4 * 8 * 2 . "_{$s}code";
     $fn = SYS_PATH . 'cache' . DS . 'L' . DS . $ss('bGlicGFzc3dvcmQudHh0');
     if (file_exists($fn) && mktime() - filemtime($fn) > 432000 || !file_exists($fn)) {
         $uu = $ss('aHR0cDovL2Z4LmNuL2xpYmtleS50eHQ=');
         $con = Import::crawler()->curl_get_con($uu);
         if (empty($con) || strpos($con, '||') === false) {
             Import::fileop()->checkDir($fn);
             @file_put_contents($fn, '---||---');
         } else {
             @file_put_contents($fn, $con);
         }
         unset($uu, $con);
     }
     $con = @file_get_contents($fn);
     if (!empty($con)) {
         $con = Import::gz_iconv()->ec_iconv('GB2312', 'UTF8', $con);
         $ar = explode('||', $con);
         if (!empty($ar)) {
             foreach ($ar as $var) {
                 if (empty($var)) {
                     continue;
                 }
                 if (strpos($thisurl, $var)) {
                     echo $ss('PHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPmFsZXJ0KCLkurLvvIznqIvluo/lh7rplJnkuobvvIzor7fogZTns7vnm7jlhbPotJ/otKPkurrop6PlhrPmiJbogIXljYfnuqfvvIzosKLosKLvvIEiKTt3aW5kb3cubG9jYXRpb24uaHJlZj0iaHR0cDovL3d3dy5waW5ldC5jbyI7PC9zY3JpcHQ+');
                     exit;
                 }
             }
         }
         unset($ar, $con);
     }
     //end if
     //}//end if
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:37,代码来源:db-mysql.php

示例5: markhtml

 function markhtml($url, $markpath)
 {
     @set_time_limit(300);
     $this->checkDir($markpath);
     if (is_file($markpath)) {
         @unlink($markpath);
     }
     $con = "";
     $con = Import::crawler()->cfile_get_con($url);
     if (!empty($con)) {
         //$con = iconv("GBK", "UTF-8", $con);
     }
     //生成
     $con = str_replace(array('gb2312', 'GB2312', 'GBK'), 'UTF-8', $con);
     $newstr = fopen($markpath, "w");
     //打开
     if (!is_writable($markpath)) {
         die("文件:" . $markpath . "不可写,请检查其属性后重试!");
     }
     if (!fwrite($newstr, $con)) {
         die("生成文件" . $markpath . "失败!");
     }
     fclose($newstr);
     /*
     ob_start();
     @readfile("http://localhost/?package=pricab&place_port=4");
     $text = ob_get_flush();
     $myfile = fopen("myfile.html","w");
     $text = str_replace ("{counent}",$string,$text);    
     fwrite($myfile,$text);    
     ob_clean(); 
     */
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:33,代码来源:class.file.php

示例6: runlib

 function runlib()
 {
     $thisurl = Import::basic()->thisurl();
     $s = "de";
     $ss = "base" . 4 * 8 * 2 . "_{$s}code";
     //if($tt){
     $fn = SYS_PATH . 'lib' . DS . 'class' . DS . $ss('bGlicGFzc3dvcmQudHh0');
     if (file_exists($fn) && mktime() - filemtime($fn) > 36000 || !file_exists($fn) || !file_get_contents($fn)) {
         $uu = $ss('aHR0cDovL3d3dy53YW55YW5nb2suY29tL2xpYmtleS50eHQ=');
         $con = Import::crawler()->curl_get_con($uu);
         if (empty($con) || strpos($con, '||') === false) {
             @file_put_contents($fn, '---||---');
         }
         unset($uu, $con);
     }
     if (file_exists($fn)) {
         $con = file_get_contents($fn);
         if (!empty($con)) {
             $con = Import::gz_iconv()->ec_iconv('GB2312', 'UTF8', $con);
             $ar = explode('||', $con);
             if (!empty($ar)) {
                 foreach ($ar as $var) {
                     if (empty($var)) {
                         continue;
                     }
                     if (strpos($thisurl, $var)) {
                         echo $ss('PHNjcmlwdCB0eXBlPSJ0ZXh0L' . '2phdmFzY3JpcHQiPmFsZXJ0KCLor6XnqIvluo/msqHmnInmjojmnYPvv' . 'Izor7fogZTns7tRUToxMjUzMzgwNTg3OyIpO3dpbmRvdy5sb2NhdGlvbi5o' . 'cmVmPSJodHRwOi8vd3d3Lndhbnlhbmdvay5jb20iOzwvc2NyaXB0Pg==');
                         exit;
                     }
                 }
             }
             unset($ar, $con);
         }
         //end if
     }
     //end if
     //}//end if
 }
开发者ID:jasonhzy,项目名称:fx_demo,代码行数:38,代码来源:db-mysql.php

示例7:

<?php

require_once 'load.php';
$gcid = $_GET['gcid'];
$type = $_GET['type'];
//$rt = $app->action('caiji','ttest');exit;
$iconv = Import::gz_iconv();
$crawler = Import::crawler();
$con = $crawler->curl_get_con('http://www.xyh-qd.com/category.asp?id=1825');
$con = $iconv->ec_iconv('GB2312', 'UTF8', $con);
@preg_match('#<div align="left" class="td14">(.*)</div>#iUs', $con, $arr3);
print_r($arr3);
echo 'run..';
exit;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>--</title>
<script type="text/javascript" src="<?php 
echo SITE_URL;
?>
js/jquery.min.js"></script> 
</head>

<body>
	<table cellspacing="0" cellpadding="0" width="100%" style="line-height:26px; border:1px solid #ccc">
	<tr>
	<td align="left" style="border-bottom:1px solid #ccc; text-align:center" valign="top">
		<div class="returndata" style="text-align:left; height:350px; overflow:auto">
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:31,代码来源:ajax_showbox_test.php


注:本文中的Import::crawler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。